-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
51 lines (51 loc) · 2.3 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
"name": "shallow-copy",
"version": "0.0.1",
"description": "make a shallow copy of an object or array",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"tape": "~1.0.4"
},
"scripts": {
"test": "tape test/*.js"
},
"testling": {
"files": "test/*.js",
"browsers": [
"ie/8..latest",
"ff/latest",
"chrome/latest",
"safari/latest",
"opera/latest",
"android/latest",
"iphone/latest",
"ipad/latest"
]
},
"repository": {
"type": "git",
"url": "git://github.com/substack/shallow-copy.git"
},
"homepage": "https://github.com/substack/shallow-copy",
"keywords": [
"shallow",
"copy",
"data",
"object",
"array"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT",
"readme": "# shallow-copy\n\nmake a shallow copy of an object or array\n\n[![testling badge](https://ci.testling.com/substack/shallow-copy.png)](https://ci.testling.com/substack/shallow-copy)\n\n[![build status](https://secure.travis-ci.org/substack/shallow-copy.png)](http://travis-ci.org/substack/shallow-copy)\n\n# example\n\nyou can copy objects shallowly:\n\n``` js\nvar copy = require('shallow-copy');\n\nvar obj = { a: 3, b: 4, c: [5,6] };\nvar dup = copy(obj);\ndup.b *= 111;\ndup.c.push(7);\n\nconsole.log('original: ', obj);\nconsole.log('copy: ', dup);\n```\n\nand you can copy arrays shallowly:\n\n``` js\nvar copy = require('shallow-copy');\n\nvar xs = [ 3, 4, 5, { f: 6, g: 7 } ];\nvar dup = copy(xs);\ndup.unshift(1, 2);\ndup[5].g += 100;\n\nconsole.log('original: ', xs);\nconsole.log('copy: ', dup);\n```\n\n# methods\n\n``` js\nvar copy = require('shallow-copy')\n```\n\n## copy(obj)\n\nReturn a copy of the enumerable properties of the object `obj` without making\ncopies of nested objects inside of `obj`.\n\nIf `obj` is an array, the result will be an array.\nIf `obj` is an object, the result will be an object.\nIf `obj` is not an object, its value is returned.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install shallow-copy\n```\n\n# license\n\nMIT\n",
"readmeFilename": "readme.markdown",
"bugs": {
"url": "https://github.com/substack/shallow-copy/issues"
},
"_id": "shallow-copy@0.0.1",
"_from": "shallow-copy@0.0.1"
}