Created
May 8, 2018 19:47
-
-
Save FelipeBarrosCruz/245f0ff6748a13bfacc299ec81596735 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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