Skip to content

Commit

Permalink
Merge pull request #126 from Gerhut/fix-omit
Browse files Browse the repository at this point in the history
Fix omit func in core-utils.ts
  • Loading branch information
aeagle authored Aug 15, 2022
2 parents b5e1303 + 2b2db71 commit 197f54e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/core-utils.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { ISpaceDefinition, SizeUnit, ISize, ResizeHandlePlacement, Type } from "./core-types";

export function omit<K extends string, T extends Record<K, unknown>>(object: T, ...keys: K[]): Omit<T, K> {
const keySet = new Set<string>(keys)
const result = Object.create(null) as Omit<T, K>
for (const key in Object.keys(object)) {
if (!keySet.has(key)) {
result[key] = object[key]
const keySet = Object.create(null) as Record<K, true>;
keys.forEach((key) => {
keySet[key] = true;
});

const result = Object.create(null) as Omit<T, K>;
Object.keys(object).forEach((key) => {
if (!keySet[key]) {
result[key] = object[key];
}
}
return result
});

return result;
}

export function shortuuid() {
Expand Down

0 comments on commit 197f54e

Please sign in to comment.