Socket
Socket
Sign inDemoInstall

prototypes

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prototypes - npm Package Compare versions

Comparing version 0.4.3 to 1.0.0

22

lib/array.js

@@ -82,3 +82,3 @@ 'use strict';

/**
* Returns the intersection of an array with another given
* Returns the intersection of the array with the parameter.
*/

@@ -100,3 +100,3 @@ newArray.intersect = function (array) {

/**
* Returns the difference between the array and another given
* Returns the difference between the array and the parameter.
*/

@@ -106,10 +106,18 @@ newArray.difference = function (array) {

var index = -1;
while (++index < this.length) {
if (!array.contains(this[index])) {
diff.push(this[index]);
}
while (++index < this.length) {
if (!array.contains(this[index])) {
diff.push(this[index]);
}
return diff;
}
return diff;
};
/**
* Returns the array flattened just one level.
*/
newArray.concatAll = function()
{
return [].concat.apply([], this);
};
// add new object functions as properties

@@ -116,0 +124,0 @@ core.addProperties(Array.prototype, newArray);

{
"name": "prototypes",
"version": "0.4.3",
"version": "1.0.0",
"description": "Some common prototypes for node.js: string.startsWith(), object.countProperties() and more. Facilities for functional programming with objects: object.forEach(), object.filter(). Functions are added safely using Object.defineProperty().",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/alexfernandez/prototypes",

@@ -340,2 +340,11 @@ [![Build Status](https://secure.travis-ci.org/alexfernandez/prototypes.png)](http://travis-ci.org/alexfernandez/prototypes)

### array.concatAll()
Flattens just one level of nested array. Example:
```
[1, 2, [3, 4, [5, 6]]].concatAll();
\=> [1, 2, 3, 4, [5, 6]]
```
### Array.toArray(object)

@@ -342,0 +351,0 @@

@@ -103,2 +103,9 @@ 'use strict';

function testConcatAll(callback)
{
var result = [1, 2, [3, 4, [5, 6]]].concatAll();
testing.assertEquals(result.length, 5, 'Should only flatten one level', callback);
testing.success(callback);
}
/**

@@ -117,2 +124,3 @@ * Run package tests.

testToArray,
testConcatAll,
];

@@ -119,0 +127,0 @@ testing.run(tests, callback);

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