shallow-copy

WebJar for shallow-copy

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

shallow-copy
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

shallow-copy
WebJar for shallow-copy
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/substack/shallow-copy

Download shallow-copy

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/shallow-copy/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>shallow-copy</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/shallow-copy/
implementation 'org.webjars.npm:shallow-copy:0.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/shallow-copy/
implementation ("org.webjars.npm:shallow-copy:0.0.1")
'org.webjars.npm:shallow-copy:jar:0.0.1'
<dependency org="org.webjars.npm" name="shallow-copy" rev="0.0.1">
  <artifact name="shallow-copy" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='shallow-copy', version='0.0.1')
)
libraryDependencies += "org.webjars.npm" % "shallow-copy" % "0.0.1"
[org.webjars.npm/shallow-copy "0.0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

shallow-copy

make a shallow copy of an object or array

testling badge

build status

example

you can copy objects shallowly:

var copy = require('shallow-copy');

var obj = { a: 3, b: 4, c: [5,6] };
var dup = copy(obj);
dup.b *= 111;
dup.c.push(7);

console.log('original: ', obj);
console.log('copy: ', dup);

and you can copy arrays shallowly:

var copy = require('shallow-copy');

var xs = [ 3, 4, 5, { f: 6, g: 7 } ];
var dup = copy(xs);
dup.unshift(1, 2);
dup[5].g += 100;

console.log('original: ', xs);
console.log('copy: ', dup);

methods

var copy = require('shallow-copy')

copy(obj)

Return a copy of the enumerable properties of the object obj without making copies of nested objects inside of obj.

If obj is an array, the result will be an array. If obj is an object, the result will be an object. If obj is not an object, its value is returned.

install

With npm do:

npm install shallow-copy

license

MIT

Versions

Version
0.0.1