Coder Social home page Coder Social logo

itemstore's Introduction

itemstore

A composite array data structure to store items (number, string, object, etc.) and additional properties.

(as a practice and example of publishing NPM module and writing test module)

Installation

npm install itemstore

Usage example:

var store = require('itemstore');
var collection = new store();

var items = ['item', {id: 1, name: 'Adam'}, 123];
var props = [{bag: ['organge', 'apple', 'strawberry']}, {id: 1, name: 'Adam'}, 'test'];

// append item and its properties, item and properties can be any type
var i = 0;
while (i < items.length) {
	collection.append(items[i], props[i]);
	i++;
}

// check itemstore size
console.log(collection.size);

// traverse items and properties
collection.each(function(item, prop) {
  console.log(item, prop);
});

// set certain item's properties
collection.setProp(items[0], props[1]);

// get certain item's properties
console.log(collection.getProp(items[0]))

// remove item and its properties
collection.remove(items[0]);

itemstore's People

Contributors

quarkli avatar gatherhub avatar

Stargazers

Phenix avatar

Watchers

 avatar  avatar

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.