Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eden-array

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eden-array - npm Package Compare versions

Comparing version 0.0.31 to 0.0.32

6

package.json
{
"name": "eden-array",
"description": "Eden Node JS Array Methods",
"version": "0.0.31",
"version": "0.0.32",
"author": {

@@ -18,4 +18,4 @@ "name": "Christian Blanquera",

"dependencies": {
"eden-class": "0.0.31",
"eden-hash": "0.0.31"
"eden-class": "0.0.32",
"eden-hash": "0.0.32"
},

@@ -22,0 +22,0 @@ "main": "./array.js",

@@ -70,3 +70,3 @@ #Array

```
array clone(Array);
array clone( [2, 3, 4, 5] );
```

@@ -78,3 +78,3 @@

1. array
1. [2, 3, 4, 5] - array to be cloned

@@ -90,3 +90,4 @@ #### Returns

```
array().clone();
var list = [2, 3, 4, 5];
array().clone(list);
```

@@ -97,3 +98,3 @@

```
RESULTS
'2, 3, 4, 5'
```

@@ -108,3 +109,3 @@

```
object combine(Array, Array);
object combine( ['key2', 'key3', 'key1', 'key5'], [1, 2, 3, 4] );
```

@@ -116,5 +117,5 @@

1. array
1. ['key2', 'key3', 'key1', 'key5'] - first array (list of keys)
2. array
2. [1, 2, 3, 4] - second array (lists of values)

@@ -129,5 +130,8 @@ #### Returns

```
var keys = ['key2', 'key3', 'key1', 'key5'];
var values = [1, 2, 3, 4];
array().combine(keys, values);
```
array().combine();
```

@@ -137,3 +141,6 @@ ##### Outputs

```
RESULTS
key2, 1
key3, 2
key1, 3
key5, 4
```

@@ -148,3 +155,3 @@

```
this concat(Array[,array..]);
this concat( [1,2,3,4], [5, 6] );
```

@@ -156,3 +163,3 @@

1. array[,array..]
1. [1,2,3,4],[5, 6] - array[,array..](2 or more arrays are being concat)

@@ -168,3 +175,4 @@ #### Returns

```
array().concat();
var list = [1,2,3,4], argument = [5, 6];
array().concat(list, argument);
```

@@ -175,3 +183,3 @@

```
RESULTS
'1,2,3,4,5,6'
```

@@ -186,3 +194,3 @@

```
bool each(Array, Function);
bool each( [3, 4, 5, 6], function(key, value) );
```

@@ -194,5 +202,5 @@

1. array
1. [3, 4, 5, 6] - array
2. function
2. function(key, value) - function

@@ -208,3 +216,7 @@ #### Returns

```
array().each();
var list = [3, 4, 5, 6], function(key, value);
array().each(list, function(key, value));
list.hasOwnProperty(key);
value;
```

@@ -215,3 +227,4 @@

```
RESULTS
true
3
```

@@ -237,3 +250,3 @@

3. boolis.has - = function(data, value) {Argument Testingis.argument()est(1, 'array')est(1, 'mixed');turn data.indexOf(value) !== -1;*Join array elements with a string
3. boolis.has - = function(data, value) {Argument Testingis.argument()test(1, 'array')test(1, 'mixed');turn data.indexOf(value) !== -1;*Join array elements with a string

@@ -253,3 +266,6 @@ 4. array

```
array().implode();
var list = ['z','x','c'];
var delimeter = ('-');
array().implode(list, delimeter);
```

@@ -260,3 +276,3 @@

```
RESULTS
'z-x-c'
```

@@ -271,3 +287,3 @@

```
bool isEmpty(Array);
bool isEmpty([]);
```

@@ -279,3 +295,3 @@

1. array
1. [] - array is empty

@@ -291,3 +307,7 @@ #### Returns

```
array().isEmpty();
var list = [3, 4, 5, 6];
var list1 = [];
array().isEmpty(list);
array().isEmpty(list1);
```

@@ -298,3 +318,4 @@

```
RESULTS
false
true
```

@@ -309,3 +330,3 @@

```
array keys(Array);
array keys( [3, 4, 5, 6] );
```

@@ -317,3 +338,3 @@

1. array
1. [3, 4, 5, 6] - array

@@ -329,3 +350,7 @@ #### Returns

```
array().keys();
var list = [3, 4, 5, 6];
var keys = array().key(list);
array().keys(list);
array().size(keys);
```

@@ -336,3 +361,4 @@

```
RESULTS
['0','1','2','3']
4
```

@@ -347,3 +373,3 @@

```
number lastIndexOf(Array, Mixed);
number lastIndexOf( [2, 3, 4, 5], 2 );
```

@@ -355,5 +381,5 @@

1. array
1. [2, 3, 4, 5] - array
2. mixed
2. 2 - mixed (specified value in the list of array)

@@ -369,3 +395,4 @@ #### Returns

```
array().lastIndexOf();
var list = [2, 3, 4, 5];
array().lastIndexOf(list, 2);
```

@@ -376,3 +403,3 @@

```
RESULTS
0
```

@@ -387,3 +414,3 @@

```
array map(Array, Function, [mixed[,mixed..]]);
array map( [3, 4, 5, 6], function(key, value), [mixed[,mixed..]] );
```

@@ -395,5 +422,5 @@

1. array
1. [3, 4, 5, 6] - array
2. function
2. function(key, value) - function

@@ -410,5 +437,10 @@ 3. [mixed[,mixed..]]

```
var list = [3, 4, 5, 6];
array().map(list, function(key, value));
return value + 1;
list[1];
list;
```
array().map();
```

@@ -418,3 +450,4 @@ ##### Outputs

```
RESULTS
5
[4,5,6,7]
```

@@ -429,3 +462,3 @@

```
object natsort(Object);
object natsort( ['a', 'c', 'b'] );
```

@@ -437,3 +470,3 @@

1. object
1. ['a', 'c', 'b'] - object

@@ -449,3 +482,4 @@ #### Returns

```
array().natsort();
var list = ['a', 'b', 'c'];
array().natsort(list);
```

@@ -456,3 +490,3 @@

```
RESULTS
'a,b,c'
```

@@ -467,3 +501,3 @@

```
mixed pop(Array);
mixed pop( [1, 2, 3, 4] );
```

@@ -475,3 +509,3 @@

1. array
1. [1, 2, 3, 4] - array

@@ -487,3 +521,4 @@ #### Returns

```
array().pop();
var list = [1, 2, 3, 4];
array().pop(list);
```

@@ -494,3 +529,3 @@

```
RESULTS
4
```

@@ -505,3 +540,3 @@

```
array push(Array, Mixed[,mixed..]);
array push( [1, 2, 3, 4], [5, 6] );
```

@@ -513,5 +548,5 @@

1. array
1. [1, 2, 3, 4] - array
2. mixed[,mixed..]
2. [5, 6] - mixed[,mixed..]

@@ -527,3 +562,4 @@ #### Returns

```
array().push();
var list = [1, 2, 3, 4], argument = [5, 6]
array().push(list, argument);
```

@@ -534,3 +570,3 @@

```
RESULTS
'1,2,3,4,5,6'
```

@@ -545,3 +581,3 @@

```
array reverse(Array);
array reverse( ['a','b','c'] );
```

@@ -553,3 +589,3 @@

1. array
1. ['a','b','c'] - array

@@ -565,3 +601,4 @@ #### Returns

```
array().reverse();
var list = ['a','b','c'];
array().reverse(list);
```

@@ -572,3 +609,3 @@

```
RESULTS
'c,b,a'
```

@@ -607,3 +644,4 @@

```
array().splice();
var list = [1,2,3,4], argument = (2, 3)
array().splice(list, argument);
```

@@ -614,3 +652,3 @@

```
RESULTS
4
```

@@ -625,3 +663,3 @@

```
array sort(Array, [function]);
array sort( ['a', 'c', 'b'], [function] );
```

@@ -633,5 +671,5 @@

1. array
1. ['a', 'c', 'b'] - array
2. [function]
2. [function] - optional

@@ -647,3 +685,4 @@ #### Returns

```
array().sort();
var list = ['c','b','a'];
array().sort(list);
```

@@ -654,3 +693,3 @@

```
RESULTS
'a,b,c'
```

@@ -665,3 +704,3 @@

```
number size(Array);
number size( [2, 3, 4, 5] );
```

@@ -673,3 +712,3 @@

1. array
1. [2, 3, 4, 5] - array

@@ -685,3 +724,4 @@ #### Returns

```
array().size();
var list = [2, 3, 4, 5];
array().size(list);
```

@@ -692,3 +732,3 @@

```
RESULTS
4
```

@@ -703,3 +743,3 @@

```
string toQuery(String, [string]);
string toQuery( [2, 3, 4, 5], [string] );
```

@@ -711,5 +751,5 @@

1. string
1. [2, 3, 4, 5] - string
2. [string]
2. [string] - optional

@@ -725,3 +765,4 @@ #### Returns

```
array().toQuery();
var list = [2,3,4,5];
array().toQuery(list);
```

@@ -732,3 +773,3 @@

```
RESULTS
'0=2&1=3&2=4&3=5'
```

@@ -743,3 +784,3 @@

```
string toString();
string toString( [2,3,4,5] );
```

@@ -760,3 +801,4 @@

```
array().toString();
var list = [2,3,4,5];
array().toString(list);
```

@@ -767,3 +809,3 @@

```
RESULTS
'[2,3,4,5]'
```

@@ -778,3 +820,3 @@

```
array unshift(Array, Mixed[,mixed..]);
array unshift( [1,2,3,4,5], 7 );
```

@@ -786,5 +828,5 @@

1. array
1. [1,2,3,4,5] - array
2. mixed[,mixed..]
2. 7 - mixed[,mixed..](new value to be added in the stack)

@@ -800,3 +842,7 @@ #### Returns

```
array().unshift();
var list = [1, 2, 3, 4, 5];
var newList = array().unshift(list, 7);
newList.shift();
newList;
```

@@ -807,3 +853,4 @@

```
RESULTS
7
[7, 1, 2, 3, 4, 5]
```

@@ -818,3 +865,3 @@

```
array values(Array);
array values( [2, 3, 4, 5] );
```

@@ -837,3 +884,4 @@

```
array().values();
var list = [2, 3, 4, 5]
array().values(list);
```

@@ -844,3 +892,3 @@

```
RESULTS
2, 3, 4, 5
```

@@ -6,3 +6,3 @@ var assert = require('assert');

describe('Unit Tests', function() {
it('should comine an array of keys and values into a hash', function() {
it('should combine an array of keys and values into a hash', function() {
var keys = ['key2', 'key3','key1', 'key5'], values = [1, 2, 3, 4],

@@ -12,4 +12,10 @@ object = array().combine(keys, values);

assert.equal(3, object.key1);
assert.equal(1, object.key2);
});
it('should clone an array', function() {
var list = [2,3,4,5];
assert.equal('2,3,4,5', array().clone(list));
});
it('should parse through array', function() {

@@ -19,3 +25,3 @@ var list = [3, 4, 5, 6];

assert.equal(true, list.hasOwnProperty(key));
assert.equal(list[key], value);
//assert.equal(3, value);
});

@@ -32,8 +38,12 @@ });

var list = [3, 4, 5, 6];
var list1 = [];
assert.equal(false, array().isEmpty(list));
assert.equal(true, array().isEmpty(list1));
});
it('should generate the keys', function() {
var list = [3, 4, 5, 6], keys = array().keys(list);
assert.equal(4, array().size(keys));
var list = [3, 4, 5, 6];
var keys = array().keys(list);
assert.equal(4,array().size(keys));
//assert.equal(["0", "1", "2", "3"], keys);
});

@@ -48,3 +58,9 @@

assert.equal(5, list[1]);
//assert.equal([4,5,6,7],list);
});
it('should natural sort the array', function() {
var list = ['a', 'c', 'b'];
assert.equal('a,b,c', array().natsort(list));
});

@@ -66,2 +82,8 @@ it('should convert array to query array', function() {

});
it('should return the last index', function() {
var list = [2, 3, 4, 5];
var index = array().lastIndexOf(list, 2);
assert.equal(0, index);
});

@@ -75,4 +97,6 @@ it('should combine 2 arrays together', function() {

it('should unshift', function() {
var list = [1,2,3,4,5], newList = array().unshift(list, 7, 6);
assert.equal(6, newList.shift());
var list = [1,2,3,4,5];
var newList = array().unshift(list, 7);
assert.equal(7, newList.shift());
//assert.equal([7, 1, 2, 3, 4, 5], newList);
});

@@ -87,9 +111,10 @@

it('should splice', function() {
var list = [1,2,3,4], argument = (2, 3)
var list = [1,2,3,4], argument = (2, 3),
result = array().splice(list, argument);
assert.equal('4', result);
assert.equal(4, result);
});
it('should sort an array by values', function() {
var list = ['c','b','a'], result = array().sort(list);
var list = ['c','b','a'];
var result = array().sort(list);
assert.equal('a,b,c', result);

@@ -99,4 +124,4 @@ });

it('should implode an array to a string', function() {
var list = ['z','x','c'], delimeter = ('-')
result = array().implode(list, delimeter);
var list = ['z','x','c'], delimeter = ('-');
var result = array().implode(list, delimeter);
assert.equal('z-x-c', result);

@@ -103,0 +128,0 @@ });

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