concept-store

0.0.2 • Public • Published

concept-store

concept-store provides an API for storing, naming, and retrieving "word clouds" and "concepts"

Installing

npm install concept-store

Usage

Require and Initialize

var ConceptStore = require('concept-store');
 
var C = new ConceptStore({
   api: 'SEE_PRIVATE_REPO_FOR_URL' 
});
Save concept without name
var myConcept = {
    data: {
        a: 12,
        b: 2,
        c: 17,
        g: 8
    }
}
 
C.saveConcept(myConcept, function(err, data) {
    console.log(data);
    myConcept._id = data._id;
});
5A```
```bash
saved concept {"_id":"541c7efcbf7a351f0063c1dd"}
Name concept
C.nameConcept({id: 'YOUR_ID', name: 'YOUR_NAME'}, function(err, name) {
    console.log('named concept ' + name));
});
Get concept by name
C.getConceptByName('YOUR_NAME', function(err, concept) {
    if(err) console.log(err);
    else console.log('got concept ' + JSON.stringify(concept));
});
Get concept by id
C.getConceptById('YOUR_ID', function(err, concept) {
    if(err) console.log(err);
    else console.log('got concept ' + JSON.stringify(concept));
});
Get all concepts
C.getAllConcepts(function(err, concepts) {
    if(err) console.log(err);
    else console.log('found ' + concepts.length + ' concepts');
});
Delete concept
C.deleteConcept('YOUR_ID', function(err, result) {
    if(err) console.log(err);
    else if(result === 1) console.log('deleted concept');
});

Readme

Keywords

Package Sidebar

Install

npm i concept-store

Weekly Downloads

7

Version

0.0.2

License

none

Last publish

Collaborators

  • kmdeland