Skip to content

Commit

Permalink
feat(emptyObject): add emptyObject function
Browse files Browse the repository at this point in the history
  • Loading branch information
djcsdy committed Feb 17, 2023
1 parent d9826dd commit f328cbf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export function object<T extends object>(properties: T): NotFunction<T> {
return Object.assign(Object.create(null), properties) as NotFunction<T>;
}

/** Creates a new empty object with a null prototype typed as a
* `Partial<T>`. */
export function emptyObject<T extends object>(): Partial<NotFunction<T>> {
return Object.create(null) as Partial<NotFunction<T>>
}

/** Creates a shallow copy of the specified object.
*
* The new object will have the same prototype as the specified object.
Expand Down

0 comments on commit f328cbf

Please sign in to comment.