Coder Social home page Coder Social logo

labelmaker's Introduction

Labelmaker

Organize your data by tags

Labelmaker is made for gunDB

What it is

If you've found yourself wanting a tagging system for gun, this is what you've been looking for. Labelmaker allows you to organize and retrieve your data by any of it's associated tags/groups.

Note: you cannot tag primitives. For that, use .key.

How to use it

Node.js

npm install labelmaker

to install it, then you can require it from your app:

var labler = require('labelmaker')

Labelmaker works with both gun version 0.2 and 0.3. Since it doesn't assume your version, you need to tell it explicitly by giving it the constructor you're using:

var Gun = require('gun')
labler(Gun)
// You now have tag support!

Browser

For the browser, it's much simpler, since your version of gun is exported as a global. Just include it as a script tag, and labelmaker takes care of the rest.

<script src="tag.min.js"></script>
<!-- all done! -->

API

Two methods are exposed for your gun instances:

  • .tag
  • .tagged

gun.tag(name[, name...])

You can pass .tag multiple names to index a node under. When called, it will try to read out your current context, index it under each tag, and then place each tag under a master list of every tag ever used.

gun.put({
  name: 'Bob',
  profession: 'developer'
}).tag(
  'members',
  'javascript developers',
  'gunDB developers',
  'examples'
)

gun.tagged(name[, callback])

Iterate over the list of nodes under that tag name.

gun.tagged('members', function (member, ID) {
  view.show.user(member, ID)
})

Roadmap

Here are some goals for labelmaker:

  • option to disable implicit mapping
  • ability to remove a node from a tag

Contributions are welcome!

labelmaker's People

Contributors

psychollama avatar greenkeeperio-bot avatar

Watchers

James Cloos avatar Mark Chipman and sidekick Mollie 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.