diff --git a/node_modules/taffydb/README.md b/node_modules/taffydb/README.md
index 52d14a3a..2b449bb1 100644
--- a/node_modules/taffydb/README.md
+++ b/node_modules/taffydb/README.md
@@ -1 +1,80 @@
-See [http://taffydb.com](http://taffydb.com).
\ No newline at end of file
+# TaffyDB (taffy.js)
+
+TaffyDB is an opensouce library that brings database features into your JavaScript applications.
+
+## Introduction
+
+How you ever noticed how JavaScript object literals look a lot like records? And that if you wrap a group of them up in an array you have something that atcs a lot like a database table? TaffyDB brings powerful database funtionality to that concept and rapidly improves the way you work with data inside of JavaScript.
+
+## What makes it sticky
+
+ - Extremely fast
+ - Powerful JavaScript centric data selection engine
+ - Database inspired features such as insert, update, unique, count, etc
+ - Robust cross browser support
+ - Easily extended with your own functions
+ - Compatible with any DOM library (jQuery, YUI, Dojo, etc)
+
+## Create a DB
+
+Just pass in JSON:
+
+ var products = TAFFY([{
+ "item":1,
+ "name":"Blue Ray Player",
+ "price":99.99
+ }, {
+ "item":2,
+ name:"3D TV",
+ price:1799.99
+ }]);
+
+
+## Find data
+
+Use JSON to compare:
+
+ var item1 = products({item:1});
+ // where item is equal to 1
+ var lowPricedItems = products({price:{lt:100}});
+ // where price is less than 100
+ var blueRayPlayers = products({name:{like:"Blue Ray"}});
+ // where name is like "Blue Ray"
+
+## Use data
+
+ // update the price of the Blue Ray Player to 89.99
+ products({item:1}).update({price:89.99});
+ // loop over the records and call a function
+ products().each(function (r) {alert(r.name)});
+ // get first record
+ products().first();
+ // get last record
+ products().last();
+ // sort the records by price descending
+ products.sort("price desc");
+ // select only the item names into an array
+ products().select("name"); // returns ["3D TV","Blue Ray Player"]
+ // inject values from a record into a string template
+ var row = products({item:2}).supplant("
| {name} | {price} |
");
+ // row now equal to "| 3D TV | 17999.99 |
"
+
+## Documentation, support, updates
+
+View more docs and examples, get support, and get notified of updates:
+
+Web: http://taffydb.com
+Twitter: http://twitter.com/biastoact
+
+
+## Software License Agreement (BSD License)
+Copyright (c)
+All rights reserved.
+
+
+Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following condition is met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/taffydb/package.json b/node_modules/taffydb/package.json
index 98bd017f..890e92a1 100644
--- a/node_modules/taffydb/package.json
+++ b/node_modules/taffydb/package.json
@@ -1,21 +1,63 @@
{
+ "author": {
+ "name": "Ian Smith"
+ },
+ "contributors": [
+ {
+ "name": "Ian Smith"
+ },
+ {
+ "name": "Todd Chambery",
+ "email": "todd.chambery@gmail.com"
+ },
+ {
+ "name": "Daniel Ruf",
+ "email": "kontakt@daniel-ruf.de"
+ },
+ {
+ "name": "Michael Mikowski",
+ "email": "mmikowski@snaplogic.com"
+ },
+ {
+ "name": "Matthew Chase Whittemore",
+ "email": "mcwhittemore@gmail.com"
+ }
+ ],
"name": "taffydb",
- "version": "2.6.2",
- "description": "An open-source library that brings database features into your JavaScript applications.",
- "main": "taffy.js",
+ "main": "./taffy",
+ "description": "TaffyDB is an opensouce library that brings database features into your JavaScript applications.",
+ "version": "2.7.2",
+ "homepage": "http://taffydb.com/",
"repository": {
"type": "git",
- "url": "git://github.com/hegemonic/taffydb.git"
+ "url": "git://github.com/typicaljoe/taffydb.git"
},
- "license": "BSD",
- "readme": "See [http://taffydb.com](http://taffydb.com).",
+ "dependencies": {},
+ "devDependencies": {},
+ "readme": "# TaffyDB (taffy.js)\r\n\r\nTaffyDB is an opensouce library that brings database features into your JavaScript applications.\r\n\r\n## Introduction\r\n\r\nHow you ever noticed how JavaScript object literals look a lot like records? And that if you wrap a group of them up in an array you have something that atcs a lot like a database table? TaffyDB brings powerful database funtionality to that concept and rapidly improves the way you work with data inside of JavaScript.\r\n\r\n## What makes it sticky\r\n\r\n - Extremely fast\r\n - Powerful JavaScript centric data selection engine\r\n - Database inspired features such as insert, update, unique, count, etc\r\n - Robust cross browser support\r\n - Easily extended with your own functions\r\n - Compatible with any DOM library (jQuery, YUI, Dojo, etc)\r\n\r\n## Create a DB\r\n\r\nJust pass in JSON:\r\n\r\n var products = TAFFY([{\r\n \"item\":1,\r\n \t\"name\":\"Blue Ray Player\",\r\n \t\"price\":99.99\r\n }, {\r\n \"item\":2,\r\n name:\"3D TV\",\r\n price:1799.99\r\n }]);\r\n\r\n\r\n## Find data\r\n\r\nUse JSON to compare:\r\n\r\n var item1 = products({item:1});\r\n // where item is equal to 1\r\n var lowPricedItems = products({price:{lt:100}});\r\n\t// where price is less than 100\r\n\tvar blueRayPlayers = products({name:{like:\"Blue Ray\"}});\r\n\t// where name is like \"Blue Ray\"\r\n\r\n## Use data\r\n\r\n // update the price of the Blue Ray Player to 89.99\r\n products({item:1}).update({price:89.99});\r\n // loop over the records and call a function\r\n products().each(function (r) {alert(r.name)});\r\n // get first record\r\n products().first();\r\n // get last record\r\n products().last();\r\n // sort the records by price descending\r\n products.sort(\"price desc\");\r\n // select only the item names into an array\r\n products().select(\"name\"); // returns [\"3D TV\",\"Blue Ray Player\"]\r\n // inject values from a record into a string template\r\n var row = products({item:2}).supplant(\"| {name} | {price} |
\");\r\n // row now equal to \"| 3D TV | 17999.99 |
\"\r\n\r\n## Documentation, support, updates\r\n\r\nView more docs and examples, get support, and get notified of updates:\r\n\r\nWeb: http://taffydb.com\r\nTwitter: http://twitter.com/biastoact \r\n\r\n\r\n## Software License Agreement (BSD License)\r\nCopyright (c)\r\nAll rights reserved.\r\n\r\n\r\nRedistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following condition is met:\r\n\r\n* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\r\n\r\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n",
"readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/hegemonic/taffydb/issues"
+ "_id": "taffydb@2.7.2",
+ "dist": {
+ "shasum": "7bf8106a5c1a48251b3e3bc0a0e1732489fd0dc8",
+ "tarball": "http://registry.npmjs.org/taffydb/-/taffydb-2.7.2.tgz"
},
- "homepage": "https://github.com/hegemonic/taffydb",
- "_id": "taffydb@2.6.2",
- "_shasum": "3c549d2f5712d7d1d109ad6bb1a4084f1b7add4e",
- "_from": "https://github.com/hegemonic/taffydb/tarball/7d100bcee0e997ee4977e273cdce60bd8933050e",
- "_resolved": "https://github.com/hegemonic/taffydb/tarball/7d100bcee0e997ee4977e273cdce60bd8933050e"
+ "_npmVersion": "1.2.0",
+ "_npmUser": {
+ "name": "mcwhittemore",
+ "email": "mcwhittemore@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "chambery",
+ "email": "todd.chambery@gmail.com"
+ },
+ {
+ "name": "mcwhittemore",
+ "email": "mcwhittemore@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "7bf8106a5c1a48251b3e3bc0a0e1732489fd0dc8",
+ "_resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.7.2.tgz",
+ "_from": "taffydb@>=2.7.2 <2.8.0"
}
diff --git a/node_modules/taffydb/taffy-test.html b/node_modules/taffydb/taffy-test.html
deleted file mode 100644
index c4df78b4..00000000
--- a/node_modules/taffydb/taffy-test.html
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
- taffy test
-
-
-
-
-
-
-
-Please open your javascript console to see test results
-
-
-
-
-
diff --git a/node_modules/taffydb/taffy.js b/node_modules/taffydb/taffy.js
index b7ad88cd..350fb470 100644
--- a/node_modules/taffydb/taffy.js
+++ b/node_modules/taffydb/taffy.js
@@ -33,7 +33,9 @@ var TAFFY, exports, T;
version, TC, idpad, cmax,
API, protectJSON, each, eachin,
isIndexable, returnFilter, runFilters,
- numcharsplit, orderByCol, run
+ numcharsplit, orderByCol, run, intersection,
+ filter, makeCid, safeForJson,
+ isRegexp
;
@@ -41,7 +43,7 @@ var TAFFY, exports, T;
// TC = Counter for Taffy DBs on page, used for unique IDs
// cmax = size of charnumarray conversion cache
// idpad = zeros to pad record IDs with
- version = '2.6.2'; // proposed mmikowski 2012-08-06
+ version = '2.7';
TC = 1;
idpad = '000000';
cmax = 1000;
@@ -61,7 +63,44 @@ var TAFFY, exports, T;
return JSON.parse( t );
}
};
+
+ // gracefully stolen from underscore.js
+ intersection = function(array1, array2) {
+ return filter(array1, function(item) {
+ return array2.indexOf(item) >= 0;
+ });
+ };
+ // gracefully stolen from underscore.js
+ filter = function(obj, iterator, context) {
+ var results = [];
+ if (obj == null) return results;
+ if (Array.prototype.filter && obj.filter === Array.prototype.filter) return obj.filter(iterator, context);
+ each(obj, function(value, index, list) {
+ if (iterator.call(context, value, index, list)) results[results.length] = value;
+ });
+ return results;
+ };
+
+ isRegexp = function(aObj) {
+ return Object.prototype.toString.call(aObj)==='[object RegExp]';
+ }
+
+ safeForJson = function(aObj) {
+ var myResult = T.isArray(aObj) ? [] : T.isObject(aObj) ? {} : null;
+ if(aObj===null) return aObj;
+ for(var i in aObj) {
+ myResult[i] = isRegexp(aObj[i]) ? aObj[i].toString() : T.isArray(aObj[i]) || T.isObject(aObj[i]) ? safeForJson(aObj[i]) : aObj[i];
+ }
+ return myResult;
+ }
+
+ makeCid = function(aContext) {
+ var myCid = JSON.stringify(aContext);
+ if(myCid.match(/regex/)===null) return myCid;
+ return JSON.stringify(safeForJson(aContext));
+ }
+
each = function ( a, fun, u ) {
var r, i, x, y;
// ****************************************
@@ -281,7 +320,10 @@ var TAFFY, exports, T;
r
;
-
+ if (typeof mvalue === 'undefined') {
+ return false;
+ }
+
if ( (s.indexOf( '!' ) === 0) && s !== bangeq &&
s !== bangeqeq )
{
@@ -316,7 +358,8 @@ var TAFFY, exports, T;
? mvalue.toLowerCase() === mtest.toLowerCase()
: mvalue === mtest) : (s === 'has')
? (T.has( mvalue, mtest )) : (s === 'hasall')
- ? (T.hasAll( mvalue, mtest )) : (
+ ? (T.hasAll( mvalue, mtest )) : (s === 'contains')
+ ? (TAFFY.isArray(mvalue) && mvalue.indexOf(mtest) > -1) : (
s.indexOf( 'is' ) === -1
&& !TAFFY.isNull( mvalue )
&& !TAFFY.isUndefined( mvalue )
@@ -807,7 +850,7 @@ var TAFFY, exports, T;
run.call( that );
each( arguments, function ( c ) {
each( that.context().results, function ( r ) {
- total = total + r[c];
+ total = total + (r[c] || 0);
});
});
return total;
@@ -1402,7 +1445,7 @@ var TAFFY, exports, T;
}
});
if ( cid === '' ){
- cid = JSON.stringify( T.mergeObj( context,
+ cid = makeCid( T.mergeObj( context,
{q : false, run : false, sort : false} ) );
}
}
@@ -1732,7 +1775,7 @@ var TAFFY, exports, T;
// ****************************************
TAFFY.has = function ( var1, var2 ) {
- var re = true, n;
+ var re = false, n;
if ( (var1.TAFFY) ){
re = var1( var2 );
@@ -1800,6 +1843,7 @@ var TAFFY, exports, T;
});
}
else if ( T.isString( var2 ) || T.isNumber( var2 ) ){
+ re = false;
for ( n = 0; n < var1.length; n++ ){
re = T.has( var1[n], var2 );
if ( re ){
diff --git a/package.json b/package.json
index c3fcbd40..4299fd9b 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,7 @@
"marked": "~0.3.2",
"requizzle": "~0.2.0",
"strip-json-comments": "~1.0.2",
- "taffydb": "https://github.com/hegemonic/taffydb/tarball/7d100bcee0e997ee4977e273cdce60bd8933050e",
+ "taffydb": "~2.7.2",
"underscore": "~1.7.0",
"wrench": "~1.5.8"
},