Skip to content

Instantly share code, notes, and snippets.

@devheedoo
Last active February 17, 2020 09:36
Show Gist options
  • Save devheedoo/a5851479901cc56c372f35ce211b713d to your computer and use it in GitHub Desktop.
Save devheedoo/a5851479901cc56c372f35ce211b713d to your computer and use it in GitHub Desktop.
Get object except some properties
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