JSPM

@f/clone-shallow

1.1.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 119
  • Score
    100M100P100Q83162F
  • License MIT

Create a shallow clone of an object or array

Package Exports

  • @f/clone-shallow

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@f/clone-shallow) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

clone-shallow

Build status Git tag NPM version Code style

Create a shallow clone of an object or array

Installation

$ npm install @f/clone-shallow

Usage

var clone = require('@f/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