gs-collection
TypeScript icon, indicating that this package has built-in type declarations

1.0.34 • Public • Published

GS-Collection

This module inspired by abalabahaha

Instalation (with npm)

npm i gs-collection@latest

Usage

GS-Collection is remastered version of @discordjs/collection, so if pro at @discordjs/collection may be you can use GS-Collection too.

Apart from being a Collection, you can also use mixin to mix two different objects, getTypeOf to get the type of all objects, baseObjectBase` to convert a data.

DJSCollection imported from @discordjs/collection. instantLazy imported from aio-get-all-files.

Sample Code
const { Collection } = require("gs-collection");

const coll = new Collection({ 
    entries: [ /* ["a", "value"], ["b", "value"] */ ],

    /**
     * Now this must have a parameter definer
     * 
     * @param {*} a you can to not provide type type of parameter
     */
    baseObject: function logic(a) { /* logic */ } /* Can be a class or function */,

    keyIndex: id" /* Index to get property to be key of an entry & Must be a string */
});

coll.add(false, { id: "1" }); // output: { "id": "1" }
coll.add(false, { id: "2" }); // output: { "id": "2" }
coll.add(false, { id: "3" }); // output: { "id": "2" }

coll.update({ id: "3", role: "Member" });  // output: { "old": { "id": "3" }, "updated": { "id": "3", "role": "Member" } }
coll.remove({ id: "1" });  // output: { "id": "1" }

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.34
    0
    • latest

Version History

Package Sidebar

Install

npm i gs-collection

Weekly Downloads

54

Version

1.0.34

License

ISC

Unpacked Size

9.02 kB

Total Files

4

Last publish

Collaborators

  • gsentertaimentdev