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

copy-anything

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-anything - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

dist/index.cjs

93

package.json
{
"name": "copy-anything",
"sideEffects": false,
"version": "2.0.3",
"type": "module",
"version": "2.0.4",
"description": "An optimised way to copy'ing an object. A small and simple integration",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"typings": "types/index.d.ts",
"module": "./dist/index.es.js",
"main": "./dist/index.cjs",
"types": "./dist/types/index.d.ts",
"exports": {
".": {
"import": "./dist/index.es.js",
"require": "./dist/index.cjs",
"types": "./dist/types/index.d.ts"
}
},
"files": [
"dist"
],
"engines": {
"node": ">=12.13",
"npm": ">=7"
},
"scripts": {
"test": "ava",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"rollup": "rollup -c build/rollup.js",
"build": "npm run lint && npm run test && npm run rollup"
"test": "vitest run",
"lint": "tsc --noEmit && eslint ./src --ext .ts",
"build": "rollup -c ./scripts/build.js",
"release": "npm run lint && del dist && npm run build && np"
},
"dependencies": {
"is-what": "^3.12.0"
"is-what": "^4.1.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2",
"ava": "^3.15.0",
"eslint": "^7.19.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-tree-shaking": "^1.8.0",
"rollup": "^2.38.4",
"rollup-plugin-typescript2": "^0.29.0",
"ts-node": "^9.1.1",
"tsconfig-paths": "^3.9.0",
"typescript": "^4.1.3"
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"del-cli": "^4.0.1",
"eslint": "^8.7.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-tree-shaking": "^1.10.0",
"np": "^7.6.0",
"prettier": "^2.5.1",
"rollup": "^2.66.0",
"rollup-plugin-typescript2": "^0.31.1",
"typescript": "^4.5.5",
"vitest": "^0.2.1"
},

@@ -46,2 +62,3 @@ "keywords": [

"author": "Luca Ban - Mesqueeb",
"funding": "https://github.com/sponsors/mesqueeb",
"license": "MIT",

@@ -56,11 +73,33 @@ "bugs": {

},
"ava": {
"extensions": [
"ts"
"np": {
"yarn": false,
"branch": "production"
},
"eslintConfig": {
"ignorePatterns": [
"node_modules",
"dist",
"scripts",
"test"
],
"require": [
"tsconfig-paths/register",
"ts-node/register"
]
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"tree-shaking"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"tree-shaking/no-side-effects-in-initialization": "error",
"@typescript-eslint/ban-ts-comment": "off"
}
}
}
# Copy anything 🎭
<a href="https://www.npmjs.com/package/copy-anything"><img src="https://img.shields.io/npm/v/copy-anything.svg" alt="Total Downloads"></a>
<a href="https://www.npmjs.com/package/copy-anything"><img src="https://img.shields.io/npm/dw/copy-anything.svg" alt="Latest Stable Version"></a>
```

@@ -39,2 +42,3 @@ npm i copy-anything

<!-- prettier-ignore-start -->
```js

@@ -46,10 +50,10 @@ import { copy } from 'copy-anything'

// now if we change a nested prop like the type:
// now if we change a nested prop like the type
copy.type.water = false
copy.type.fire = true(
// new prop
// or add a new nested prop
copy.type.fire = true
// then the original object will still be the same:
original.type.water === true
)(original.type.fire === undefined)
// then the original object will still be the same:
(original.type.water === true) // true
(original.type.fire === undefined) // true
```

@@ -67,10 +71,10 @@

// now if we change a prop in the array like so:
// now if we change a prop in the array
copy[0].name = 'Wartortle'
copy.push({ name: 'Charmander' })(
// new item
// or add a new item to the array
copy.push({ name: 'Charmander' })
// then the original array will still be the same:
original[0].name === 'Squirtle'
)(original[1] === undefined)
// then the original array will still be the same:
(original[0].name === 'Squirtle') // true
(original[1] === undefined) // true
```

@@ -92,3 +96,6 @@

const copy1 = copy(original)
const copy2 = copy(original, { nonenumerable: true })(copy1.id === undefined)(copy2.id === '001')
(copy1.id === undefined) // true
const copy2 = copy(original, { nonenumerable: true })
(copy2.id === '001') // true
```

@@ -102,3 +109,5 @@

const original = { name: 'Flareon', type: ['fire'], id: '136' }
const copy = copy(original, { props: ['name'] })(copy === { name: 'Flareon' })
const copy = copy(original, { props: ['name'] })
(copy) // will look like: `{ name: 'Flareon' }`
```

@@ -108,2 +117,3 @@

<!-- prettier-ignore-end -->
## Source code

@@ -110,0 +120,0 @@

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