Code Monkey home page Code Monkey logo

grumpy's Introduction

This was originally a TypeScript port with extra features of @discordjs/collection when it was written in JavaScript and integrated into the monorepo. Please do not use this package, use @discordjs/collection for a maintained version.

Grumpy

Grumpy is a NodeJS library which provides a painless way to deal with key-value storage. It's much more efficient than Object/Array hashmaps because it is based off of Javascript's built in Map class.

What does Grumpy do?

Most things that you can do with Array and Map can be done using Grumpy! Here are a few examples to get you started:

  • Add/remove sets of values in a scoped Group.
  • Convert Groups into other data structures.
  • Manipulate Groups using familiar Array methods.
  • Fetch values from Groups using built-in methods.
Why should I use Grumpy?
  • Small file size (~1kb).
  • Blazing fast performance.
  • Minimal & intuitive API.

Try it out here: https://npm.runkit.com/grumpy

Getting Started

Installation

To use Grumpy in your project, run:

yarn add grumpy
# or "npm install grumpy"

Usage

Note: Grumpy requires at least Node v6.4.0.

Create an instance of Grumpy and manipulate the group. We're going to be assigning key to value and fetching and checking it once we've set it.

Example - Getting and setting values

Save file as example.js

const Grumpy = require('grumpy');
const group = new Grumpy();

group.set('key', 'value');

group.get('key'); // returns 'value'
group.has('key'); // returns true

Execute script on the command line

node example.js

More Examples

grumpy's People

Contributors

aidenybai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

galaxy-mc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.