Skip to content

Commit

Permalink
Fix object/omit props string conversion.
Browse files Browse the repository at this point in the history
Resolves: #22
  • Loading branch information
osorokotyaga committed Oct 22, 2018
1 parent fde1e6c commit 84bbf83
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/object/omit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ import objectKeys from './keys';
* omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3}
*/
export default curryN(2, (props = [], obj = {}) => {
const propsSet = Object.create(null);

for (let i = 0; i < props.length; i++) {
propsSet[props[i]] = true;
}

const result = {};
const keys = objectKeys(obj);

for (let i = 0; i < keys.length; i++) {
const prop = keys[i];

if (props.indexOf(prop) === -1) {
if (!propsSet[prop]) {
result[prop] = obj[prop];
}
}
Expand Down

0 comments on commit 84bbf83

Please sign in to comment.