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

1.0.32 • 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"] */ ], baseObject: LogicClass /* Can be a class or function */, keyIndex: id" /* Index to get property to be key of an entry & Must be a string */ });
coll.add({ id: "1" }); // output: { "id": "1" }
coll.add({ id: "2" }); // output: { "id": "2" }
coll.add({ 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" }

Package Sidebar

Install

npm i gs-collection

Weekly Downloads

16

Version

1.0.32

License

ISC

Unpacked Size

8.59 kB

Total Files

4

Last publish

Collaborators

  • gsentertaimentdev