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

@modcord/collection

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@modcord/collection

A Map with additional utility methods for significantly improved performance and ease-of-use.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

collection-map-js

A Map with additional utility methods to use.

Help, Issued & Support

If you have encountered a bug with the library, open a pull request

Methods

The Collection extends Map. collection is reffered as const collection = new Collection(); where Collection is reffered as const Collection = require("collection-map-js").Collection;.

// [Parameter] means that that parameter is optional, do not include []'s.

collection.filter(function); // function takes in 'value'
collection.clone(); // returns an exact same copy of current collection
collection.first([count]); // returns first x or first value of the collection
collection.firstKey([count]); // returns first x or first key of the collection
collection.array(); // array of collection values
collection.last([count]); // returns last x or first value of the collection
collection.lastKey([count]); // returns last x or first key of the collection
collection.deleteAll(); // calls delete method on all items of the collection
collection.every(function); // returns boolean, true if every item of the collection makes function returns true, function takes in 'value'
collecton.equals(collection2); // return boolean, true if collection2 and collection have a 100% key-vaue pairs matching
collection.keyArray(); // array of collection keys
collection.map(); // equal to Array.map();
collection.partition(function); // returns array of 2 collections, first collection item that passed function and second collection items that failed function ([collection1, collection2] or [passed, failed]), function takes in value
collection.random([count]); // returns array of 'count' random values from the collection, there can (and will be) duplicates (regardless of array length but more likely count represents a big portion of collection's size)
collection.randomKeys([count]); // returns array of 'count' random keys from the collection, there can (and will be) duplicates (regardless of array length but more likely count represents a big portion of collection's size)
collection.some(function); // returns true if at least 1 element of collection passed function, function takes in value
collection.find(function); // filters the collection and returns the first item value passing function, function takes in value

Keywords

FAQs

Package last updated on 02 Aug 2021

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