You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@micro-js/clone-shallow

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@micro-js/clone-shallow

Create a shallow clone of an object or array

1.0.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

clone-shallow

Build status Git tag NPM version Code style

Create a shallow clone of an object or array

Installation

$ npm install @micro-js/clone-shallow

Usage

var clone = require('@micro-js/clone-shallow')

var arr = [1, 2, 3, 4]
var newArr = clone(arr)

deepEqual(arr, newArr)
arr !== newArr

var obj = {a: 1, b: 2, c: 3}
var newObj = clone(obj)

deepEqual(obj, newObj)
obj !== newObj

API

cloneShallow(a)

  • a - The object or array to be cloned

Returns: A new object or array with identical contents to a.

License

MIT

FAQs

Package last updated on 06 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts