Comparing version 2.1.7 to 3.0.0-beta.0
# fast-copy CHANGELOG | ||
## 3.0.0 | ||
**Breaking changes** | ||
- Exports are now named (`copy` and `copyStrict`) instead of default | ||
## 2.1.7 | ||
@@ -4,0 +10,0 @@ |
@@ -1,39 +0,31 @@ | ||
declare namespace FastCopy { | ||
export type Realm = Record<string, any>; | ||
export interface Cache { | ||
_keys?: any[]; | ||
_values?: any[]; | ||
has: (value: any) => boolean; | ||
set: (key: any, value: any) => void; | ||
get: (key: any) => any; | ||
} | ||
export interface Cache { | ||
_keys?: any[]; | ||
_values?: any[]; | ||
has: (value: any) => boolean; | ||
set: (key: any, value: any) => void; | ||
get: (key: any) => any; | ||
} | ||
export type InternalCopier = <Value = any>(value: Value, cache: Cache) => Value; | ||
export type Copier = <Value = any>(value: Value, cache: Cache) => Value; | ||
export type ObjectCloner = <Value>( | ||
object: Value, | ||
realm: Realm, | ||
handleCopy: InternalCopier, | ||
cache: Cache | ||
) => Value; | ||
export type ObjectCloner = <Value>( | ||
object: Value, | ||
realm: Realm, | ||
handleCopy: Copier, | ||
cache: Cache, | ||
) => Value; | ||
export type Options = { | ||
isStrict?: boolean; | ||
realm?: Realm; | ||
}; | ||
export interface Options { | ||
isStrict?: boolean; | ||
realm?: Realm; | ||
} | ||
declare function copy<Value = any>( | ||
value: Value, | ||
options?: FastCopy.Options, | ||
): Value; | ||
export interface StrictOptions extends Omit<Options, 'isStrict'> {} | ||
declare namespace copy { | ||
function strictCopy<Value = any>( | ||
value: Value, | ||
options?: FastCopy.Options, | ||
): Value; | ||
} | ||
export type Realm = Record<string, any>; | ||
export default copy; | ||
export const copy: <Value = any>(value: Value, options?: Options) => Value; | ||
export const copyStrict: <Value = any>( | ||
value: Value, | ||
options?: StrictOptions | ||
) => Value; |
@@ -6,3 +6,3 @@ { | ||
], | ||
"browser": "dist/fast-copy.js", | ||
"browser": "dist/umd/index.js", | ||
"bugs": { | ||
@@ -48,2 +48,18 @@ "url": "https://github.com/planttheidea/fast-copy/issues" | ||
}, | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./dist/esm/types/index.d.ts", | ||
"default": "./dist/esm/index.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/cjs/types/index.d.ts", | ||
"default": "./dist/cjs/index.cjs" | ||
}, | ||
"default": { | ||
"types": "./dist/umd/types/index.d.ts", | ||
"default": "./dist/umd/index.js" | ||
} | ||
} | ||
}, | ||
"homepage": "https://github.com/planttheidea/fast-copy#readme", | ||
@@ -57,4 +73,4 @@ "keywords": [ | ||
"license": "MIT", | ||
"main": "dist/fast-copy.cjs.js", | ||
"module": "dist/fast-copy.esm.js", | ||
"main": "dist/cjs/index.cjs", | ||
"module": "dist/esm/index.mjs", | ||
"name": "fast-copy", | ||
@@ -66,4 +82,6 @@ "repository": { | ||
"scripts": { | ||
"benchmark": "npm run build && node benchmark/index.js", | ||
"build": "NODE_ENV=production rollup -c", | ||
"benchmark": "npm run build:files && node benchmark/index.cjs", | ||
"build": "npm run build:files && npm run build:types", | ||
"build:files": "NODE_ENV=production rollup -c", | ||
"build:types": "tsc -p ./tsconfig.cjs.json && tsc -p ./tsconfig.esm.json", | ||
"clean": "rimraf dist", | ||
@@ -84,4 +102,5 @@ "dev": "NODE_ENV=development webpack-dev-server --config=webpack/webpack.config.js", | ||
}, | ||
"type": "module", | ||
"types": "index.d.ts", | ||
"version": "2.1.7" | ||
"version": "3.0.0-beta.0" | ||
} |
@@ -29,8 +29,11 @@ # fast-copy | ||
```javascript | ||
import copy from "fast-copy"; | ||
import { deepEqual } from "fast-equals"; | ||
import { copy } from 'fast-copy'; | ||
import { deepEqual } from 'fast-equals'; | ||
const object = { | ||
array: [123, { deep: "value" }], | ||
map: new Map([["foo", {}], [{ bar: "baz" }, "quz"]]) | ||
array: [123, { deep: 'value' }], | ||
map: new Map([ | ||
['foo', {}], | ||
[{ bar: 'baz' }, 'quz'], | ||
]), | ||
}; | ||
@@ -60,6 +63,8 @@ | ||
**NOTE**: This option is also aliased as `copy.strict`. | ||
**NOTE**: This option is also aliased as `copStrict`. | ||
```javascript | ||
console.log(copy.strict(object)); | ||
import { copyStrict } from 'fast-copy'; | ||
console.log(copyStrict(object)); | ||
``` | ||
@@ -76,3 +81,3 @@ | ||
```javascript | ||
const iframe = document.querySelector("iframe"); | ||
const iframe = document.querySelector('iframe'); | ||
const arr = iframe.contentWindow.arr; | ||
@@ -209,3 +214,5 @@ | ||
- benchmark => run benchmark tests against other equality libraries | ||
- build => build dist files with `rollup` | ||
- build => run `build:files` and `build:types` | ||
- build:files => build dist files with `rollup` | ||
- build:types => build TypeScript types for consumers | ||
- clean => run `rimraf` on the `dist` folder | ||
@@ -212,0 +219,0 @@ - dev => start webpack playground App |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133273
23
1125
227
Yes
1
1