New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

extra-array

Package Overview
Dependencies
Maintainers
1
Versions
858
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-array - npm Package Compare versions

Comparing version 2.0.18 to 2.0.19

11

fresh.js

@@ -217,13 +217,2 @@ // PURE FUNCTIONS

// - manipulate input arrays
/**
* Appends arrays to end of input array!
* @param {Array} x input array
* @param {...array} ys arrays to append
* @returns input array (modified!)
*/
function append(x, ...ys) {
for(var y of ys)
Array.prototype.push.apply(x, y);
return x;
}

@@ -230,0 +219,0 @@ function cons() {

2

package.json
{
"name": "extra-array",
"version": "2.0.18",
"version": "2.0.19",
"description": "Standard utility methods for Array.",

@@ -5,0 +5,0 @@ "main": "index.js",

/**
* Gets element at index (+ve / -ve).
* Gets true index to source (+ve).
* @param {Array} x source
* @param {number} i index (-ve => from right)
* @returns {*} element
* @param {number} i index
* @returns {number} +ve index
*/
function index(x, i) {
return i<0? x.length-i:i;
}
/**
* Gets value at index (+ve, -ve).
* @param {Array} x source
* @param {number} i index (-ve: from right)
* @returns {*} value
*/
function get(x, i) {
return i<0? x[x.length-i]:x[i];
return x[index(x, i)];
}
/**
* Sets value at index (+ve, -ve).
* @param {Array} x source
* @param {number} i index (-ve: from right)
* @param {*} v value
* @returns {Array} set array
*/
function set(x, i, v) {
return splice(x, index(x, i), 1, v);
}
/**
* Sets value at index (+ve, -ve)!
* @param {Array} x target (modified!)
* @param {number} i index (-ve: from right)
* @param {*} v value
* @returns {Array} target
*/
function set$(x, i, v) {
x[index(x, i)] = v;
return x;
}
/**
* Gets first value.
* @param {Array} x source
* @returns {*} first value
*/
function head(x) {
return x[0];
}
/**
* Gets values except first.
* @param {Array} x source
* @returns {Array} except first
*/
function tail(x) {
return x.slice(1);
}
/**
* Gets values except last.
* @param {Array} x source
* @returns {Array} except last
*/
function init(x) {
return x.slice(0, -1);
}
/**
* Gets last value.
* @param {Array} x source
* @returns {*} last value
*/
function last(x) {
return x[x.length-1];
}
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