Skip to content

Commit 703d4e6

Browse files
committed
move to runtime access of Object.create
1 parent 6138a6e commit 703d4e6

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# fast-copy CHANGELOG
22

3+
## 4.0.0
4+
5+
### BREAKING CHANGES
6+
7+
- Legacy environment support has been removed; `Symbol`, `WeakMap`, and `RegExp.prototype.flags` are now expected to be present.
8+
- `createCopier` now receives an object of options. The methods passed previously are namespaced under the `methods` key in that options object.
9+
- `createStrictCopier` has been removed; please use the `strict` option passed to `createCopier`
10+
311
## 3.0.2
412

513
- [#95](https://github.com/planttheidea/fast-copy/pull/95) - Add support for objects that have a prototype with no constructor

src/utils.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export interface Cache {
44
get: (key: any) => any;
55
}
66

7-
const { create } = Object;
87
const toStringFunction = Function.prototype.toString;
98
const toStringObject = Object.prototype.toString;
109

@@ -13,15 +12,15 @@ const toStringObject = Object.prototype.toString;
1312
*/
1413
export function getCleanClone(prototype: any): any {
1514
if (!prototype) {
16-
return create(null);
15+
return Object.create(null);
1716
}
1817

1918
const Constructor = prototype.constructor;
2019

2120
if (Constructor === Object) {
2221
return prototype === Object.prototype
2322
? {}
24-
: create(prototype as object | null);
23+
: Object.create(prototype as object | null);
2524
}
2625

2726
if (
@@ -38,7 +37,7 @@ export function getCleanClone(prototype: any): any {
3837
}
3938
}
4039

41-
return create(prototype as object | null);
40+
return Object.create(prototype as object | null);
4241
}
4342

4443
/**

0 commit comments

Comments
 (0)