Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple engine to manage items, with arbitrary data and associated tags
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.npmignore
LICENSE
README.md
package.json
test.js

README.md

SimpleTags

Simple engine to manage items, with arbitrary data and associated tags.

Installation

Via npm on Node:

npm install simpletags

Reference in your program:

var simpletags = require('simpletags');

Usage

Create engine

var engine = simpletags.createEngine();

Create item in engine:

var itemId = engine.createItem('http://nodejs.org', [ 'nodejs', 'javascript', 'engine', 'programming' ]);

An item has

  • data: Arbitrary value you supplied
  • tags: An array of tags. A tag could be a non-empty string or an object with only one property with non-empty value.

Once created, the item has an associated id, supplied by the engine.

An example with object and string tags:

var itemId = engine.createItem('contract.doc', [ 'legal', 'document', { author: 'adam' } ]);

Search items by tags:

var items = engine.getItems([ 'nodejs', 'javascript', 'engine', 'programming' ]);

The return value is an array of items. Each item is a simple object with id, data, and tags properties.

Get item by id:

var item = engine.getItemById(itemId);

The return value is a simple object, with id, data, and tags properties.

Samples

TBD

To do

  • Update an item.
  • Remove an item.
  • Better internal tag structure and search algorithm.

Changelog

  • 2013-01-15: Version 0.0.1 published, with createEngine, createItem, getItemById, getItems.
  • 2013-01-16: Version 0.0.2 started in master.

Contribution

Feel free to file issues and submit pull requests — contributions are welcome.

If you submit a pull request, please be sure to add or update corresponding test cases, and ensure that npm test continues to pass.

Something went wrong with that request. Please try again.