Last active
February 17, 2020 09:36
-
-
Save devheedoo/a5851479901cc56c372f35ce211b713d to your computer and use it in GitHub Desktop.
Get object except some properties
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
const obj = { | |
a: {id: 'aa', name: 'aaa', age: 1}, | |
b: {id: 'bb', name: 'bbb', age: 2}, | |
c: {id: 'cc', name: 'ccc', age: 3}, | |
} | |
// get object except 'age' property | |
const exceptAge = ({ age, ...rest }) => rest; | |
R.map(exceptAge, obj); | |
// { | |
// "a": {"id": "aa", "name": "aaa"}, | |
// "b": {"id": "bb", "name": "bbb"}, | |
// "c": {"id": "cc", "name": "ccc"} | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment