Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wankdanker/node-object-array
Add array-like functionality to objects while using unique ids instead of numeric indexes
https://github.com/wankdanker/node-object-array
Last synced: 14 days ago
JSON representation
Add array-like functionality to objects while using unique ids instead of numeric indexes
- Host: GitHub
- URL: https://github.com/wankdanker/node-object-array
- Owner: wankdanker
- Created: 2016-01-28T03:31:30.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-23T17:19:56.000Z (about 8 years ago)
- Last Synced: 2024-12-06T01:34:59.295Z (about 1 month ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
object-array
------------Add array-like functionality to objects while using unique ids instead of numeric indexes
install
-------```sh
npm install object-array
```usage
-----```js
var ObjectArray = require('object-array');var a = ObjectArray();
a.push({ a : 1234 }, "asdf", 1234);
console.log(a);
/*
{ d4afb2e299d042cebca4a3774d4d037e: { a: 1234 },
bba722d53ebd499f9670654568903843: 'asdf',
aedc41da998a40bfbb4abd1a822212b7: 1234 }
*/
```### ObjectArray.applyPrototype(constructor)
Add the methods of ObjectArray to some other object. If no other
object is specified then the methods are applied to Object's prototype.* constructor - [optional] the object to which ObjectArray's methods
should be applied. Default: Object```js
require('object-array').applyPrototype();var a = {};
a.push("hello", "world");
console.log(a);
/*
{ a5cb5e9db6224dc292d791b7d40cb0ae: 'hello',
b909283f322746fa907cb4c16b1806e3: 'world' }
*/
```arrayish function status
------------------------* concat()
* every()
* filter() ✔
* forEach() ✔
* indexOf() ✔
* join()
* lastIndexOf()
* length ✔
* length() is implemented as a function
* map() ✔
* pop() ✔
* push() ✔
* returns an array of keys added instead of the total length of the array
* reduce()
* reduceRight()
* reverse()
* shift() ✔
* slice()
* some()
* sort()
* splice()
* unshift()license
-------MIT