Skip to content

Instantly share code, notes, and snippets.

@FelipeBarrosCruz
Created May 8, 2018 19:47
Show Gist options
  • Save FelipeBarrosCruz/245f0ff6748a13bfacc299ec81596735 to your computer and use it in GitHub Desktop.
Save FelipeBarrosCruz/245f0ff6748a13bfacc299ec81596735 to your computer and use it in GitHub Desktop.
import { PipeTransform, Pipe } from '@angular/core';
improt { isPlainObject } from 'lodash';
@Pipe({ name: 'keys' })
export class KeysPipe implements PipeTransform {
transform(value, args: string[]): Array<String> | null {
if (!isPlainObject(value)) {
return null;
}
return Object.keys(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment