Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-copy

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-copy - npm Package Compare versions

Comparing version 2.1.7 to 3.0.0-beta.0

dist/cjs/index.cjs

6

CHANGELOG.md
# 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 @@

56

index.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc