main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
887 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { complement, identity, pickBy, useWith } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | /* eslint-disable max-len */
|
---|
| 4 | /**
|
---|
| 5 | * Returns a partial copy of an object containing only the keys
|
---|
| 6 | * that don't satisfy the supplied predicate.
|
---|
| 7 | *
|
---|
| 8 | * @func omitBy
|
---|
| 9 | * @memberOf RA
|
---|
| 10 | * @since {@link https://char0n.github.io/ramda-adjunct/2.6.0|v2.6.0}
|
---|
| 11 | * @category Object
|
---|
| 12 | * @sig ((v, k) -> Boolean) -> {k: v} -> {k: v}
|
---|
| 13 | * @param {!Function} pred A predicate to determine whether or not a key should be included on the output object
|
---|
| 14 | * @param {!Object} obj The object to copy from
|
---|
| 15 | * @return {!Object} A new object only with properties that don't satisfy `pred`
|
---|
| 16 | *
|
---|
| 17 | * @example
|
---|
| 18 | *
|
---|
| 19 | * const isLowerCase = (val, key) => key.toLowerCase() === key;
|
---|
| 20 | * RA.omitBy(isLowerCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4}
|
---|
| 21 | */
|
---|
| 22 | /* eslint-enable max-len */
|
---|
| 23 | const omitBy = useWith(pickBy, [complement, identity]);
|
---|
| 24 |
|
---|
| 25 | export default omitBy;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.