Socket
Socket
Sign inDemoInstall

immutable-array-methods

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immutable-array-methods

Immutable versions of normally mutable array methods, such as pop(), push(), splice()


Version published
Weekly downloads
6
increased by500%
Maintainers
3
Weekly downloads
 
Created
Source

immutable-array-methods Build Status

Immutable versions of normally mutable array methods, such as pop(), push(), splice()

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install immutable-array-methods --save

Usage

var methods = require("immutable-array-methods");

var input = [1, 2, 3];
var result = methods.pop(input, 4);
console.log('pop()');
console.log('input is unchanged', input);
console.log('result', result);

result = methods.splice(input, 1, 1, 'foo');
console.log('splice()');
console.log('input is unchanged', input);
console.log('result', result);

// num() doesnt' return a new array if the values are unchanged
result = methods.map(input, function (num) {
  return num % 2;
});

result = methods.move([1, 2, 3], 0, 1);
console.log('move()');
console.log('input is unchanged', input);
console.log('result', result);

// also available is .push(), .shift(), .unshift(), .set()

Tests

npm install
npm test

Dependencies

None

Dev Dependencies

License

MIT

Generated by package-json-to-readme

FAQs

Package last updated on 22 Aug 2016

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

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