New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ddb

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ddb - npm Package Compare versions

Comparing version

to
0.0.2

ddb.sublime-project

22

lib/index.js

@@ -193,10 +193,8 @@ // Generated by LiveScript 1.2.0

};
prototype.all = function(kind){
kind == null && (kind = ddb.Node);
return this.assocs(this, kind);
prototype.all = function(filter){
return this.assocs(this, filter);
};
prototype.assocs = function(node, kind){
prototype.assocs = function(node, filter){
var assocs, this$ = this;
node == null && (node = this);
kind == null && (kind = ddb.Node);
assocs = this._assocs[node.qid()];

@@ -207,3 +205,3 @@ if (assocs != null) {

}).filter(function(it){
return it instanceof kind;
return it.filter(filter);
});

@@ -253,4 +251,4 @@ } else {

}
prototype.assoc = function(kind){
return this.parts.push(new constructor.Assoc(kind));
prototype.assoc = function(filter){
return this.parts.push(new constructor.Assoc(filter));
};

@@ -278,6 +276,4 @@ prototype.add = function(){

var prototype = Assoc.prototype, constructor = Assoc;
function Assoc(kind){
this.kind = kind != null
? kind
: ddb.Node;
function Assoc(filter){
this.filter = filter;
}

@@ -289,3 +285,3 @@ prototype.find = function(db, prev){

acc = acc.slice();
assocs = db.assocs(node, this$.kind);
assocs = db.assocs(node, this$.filter);
for (i$ = 0, len$ = assocs.length; i$ < len$; ++i$) {

@@ -292,0 +288,0 @@ node = assocs[i$];

{
"name": "ddb",
"version": "0.0.1",
"version": "0.0.2",
"author": "CoderPuppy",

@@ -5,0 +5,0 @@

# Dynamic Database
**A basic graph database**
**Note: This requires ES6 Collections - Enable them with --harmony-collections**
## Overview

@@ -20,4 +18,4 @@ There are two types of nodes (by default):

- *assoc(a: Node, b: Node)*: Associate *a* with *b*
- *assocs(node: Node, [kind: Kind])*: Get all the nodes associated with *node* of kind: *kind*
- *all(kind: Kind)*: Get all nodes of kind: *kind*
- *assocs(node: Node, [filter])*: Get all the nodes associated with *node* of that match filter: *filter*
- *all([filter])*: Get all nodes that match filter: *filter*

@@ -28,6 +26,26 @@ **Node**

- *id()*: ID for this node, abstract
- *filter(filter)*: Returns whether this node matches the filter, if the filter is a kind that means whether this node is an instance of the kind
**Data**
If the constructor has a property called names, methods will be generated to get and set properties.
Example:
```javascript
var util = require('util')
var ddb = require('ddb')
function Name() {
ddb.Data.apply(this, arguments)
}
Name.names = [ 'type', 'val' ]
util.inherits(Name, ddb.data)
var name = new Name('last', 'Doe')
name.type() == 'last'
name.val() == 'Doe'
```
- *new Data(data...)*: Create a new data node with data: *data*
- *filter(filter)*: If the filter is of the same type as this, it checks all the properties of the filter and (if it's not null or undefined) it compares them to our data at the same index

@@ -38,2 +56,12 @@ **ID**

**Query**
These let you seperate the definition of what to find from finding them.
- *new Query(db, base... = [ db ])*: Creates a new query on the db: *db*, starting with objects: *base*
- *assoc(filter)*: Find all the nodes (that match the filter) associated with the current set
- *add(...nodes)*: Add nodes to the current set
- *filter(filter)*: Filter the current set by the filter
- *run()*: Find all the nodes
## Example

@@ -40,0 +68,0 @@

# Todo List
- Matching data nodes
- Querys (seperating the definition from the execution)
- Performance
- Matching data nodes ✓
- Querys (seperating the definition from the execution) ✓
- Performance
- Documentation for querys and filters

Sorry, the diff of this file is not supported yet