Skip to content

Commit

Permalink
sync lodash (#391)
Browse files Browse the repository at this point in the history
* sync lodash

* update

* update

* update

* update

* update

* update

* add test case
  • Loading branch information
li-jia-nan committed Dec 12, 2022
1 parent c3ef37e commit 306aff3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/omit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function omit<T extends object, K extends keyof T>(
obj: T,
fields: K[],
fields: K[] | readonly K[],
): Omit<T, K> {
const clone = { ...obj };

Expand Down
5 changes: 5 additions & 0 deletions tests/omit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ describe('omit', () => {
const ret = omit({ bamboo: 1 }, null);
expect(ret).toEqual({ bamboo: 1 });
});

it('readonly array', () => {
const ret = omit({ keep: 1, ignore: 2 }, ['ignore'] as const);
expect(ret).toEqual({ keep: 1 });
});
});

0 comments on commit 306aff3

Please sign in to comment.