mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Revert "use npm module for taffydb (#961)"
This reverts commit 3a70553217c78d9ee29b0c21864144430da7b77a.
This commit is contained in:
parent
3a70553217
commit
de87a1b3f4
81
node_modules/taffydb/README.md
generated
vendored
81
node_modules/taffydb/README.md
generated
vendored
@ -1,80 +1 @@
|
||||
# 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("<tr><td>{name}</td><td>{price}</td></tr>");
|
||||
// row now equal to "<tr><td>3D TV</td><td>17999.99</td></tr>"
|
||||
|
||||
## 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.
|
||||
See [http://taffydb.com](http://taffydb.com).
|
||||
68
node_modules/taffydb/package.json
generated
vendored
68
node_modules/taffydb/package.json
generated
vendored
@ -1,63 +1,21 @@
|
||||
{
|
||||
"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",
|
||||
"main": "./taffy",
|
||||
"description": "TaffyDB is an opensouce library that brings database features into your JavaScript applications.",
|
||||
"version": "2.7.2",
|
||||
"homepage": "http://taffydb.com/",
|
||||
"version": "2.6.2",
|
||||
"description": "An open-source library that brings database features into your JavaScript applications.",
|
||||
"main": "taffy.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/typicaljoe/taffydb.git"
|
||||
"url": "git://github.com/hegemonic/taffydb.git"
|
||||
},
|
||||
"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(\"<tr><td>{name}</td><td>{price}</td></tr>\");\r\n // row now equal to \"<tr><td>3D TV</td><td>17999.99</td></tr>\"\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",
|
||||
"license": "BSD",
|
||||
"readme": "See [http://taffydb.com](http://taffydb.com).",
|
||||
"readmeFilename": "README.md",
|
||||
"_id": "taffydb@2.7.2",
|
||||
"dist": {
|
||||
"shasum": "7bf8106a5c1a48251b3e3bc0a0e1732489fd0dc8",
|
||||
"tarball": "http://registry.npmjs.org/taffydb/-/taffydb-2.7.2.tgz"
|
||||
"bugs": {
|
||||
"url": "https://github.com/hegemonic/taffydb/issues"
|
||||
},
|
||||
"_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"
|
||||
"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"
|
||||
}
|
||||
|
||||
84
node_modules/taffydb/taffy-test.html
generated
vendored
Normal file
84
node_modules/taffydb/taffy-test.html
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>taffy test</title>
|
||||
|
||||
<script src="./taffy.js"></script>
|
||||
|
||||
<script>
|
||||
// recursive object compare, for future use
|
||||
Object.prototype.equals = function (x) {
|
||||
var p;
|
||||
for(p in this) {
|
||||
if(typeof(x[p])=='undefined') {return false;}
|
||||
}
|
||||
|
||||
for(p in this) {
|
||||
if (this[p]) {
|
||||
switch(typeof(this[p])) {
|
||||
case 'object':
|
||||
if (! this[p].equals(x[p])) { return false; }
|
||||
break;
|
||||
case 'function':
|
||||
if (typeof(x[p])=='undefined' ||
|
||||
(p != 'equals' && this[p].toString() != x[p].toString())
|
||||
){ return false; }
|
||||
break;
|
||||
default:
|
||||
if (this[p] != x[p]) { return false; }
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (x[p]){ return false; }
|
||||
}
|
||||
}
|
||||
|
||||
for(p in x) {
|
||||
if(typeof(this[p])=='undefined') {return false;}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var key_name, data_val, friends_table, taffy_map;
|
||||
friends_table = TAFFY([
|
||||
{"id":1,"gender":"M","first":"John","last":"Smith","city":"Seattle, WA","status":"Active"},
|
||||
{"id":2,"gender":"F","first":"Kelly","last":"Ruth","city":"Dallas, TX","status":"Active"},
|
||||
{"id":3,"gender":"M","first":"Jeff","last":"Stevenson","city":"Washington, D.C.","status":"Active"},
|
||||
{"id":4,"gender":"F","first":"Jennifer","last":"Gill","city":"Seattle, WA","status":"Active"}
|
||||
]);
|
||||
|
||||
taffy_map = {
|
||||
t_by_city : friends_table({city:"Seattle, WA"}),
|
||||
t_by_id : friends_table({id:1}),
|
||||
t_by_id_f : friends_table({id:'1'}),
|
||||
t_by_name : friends_table({first:'John',last:'Smith'}),
|
||||
kelly_by_id : friends_table({id:2}).first(),
|
||||
kelly_last_name : friends_table({id:2}).first().last,
|
||||
id_list : friends_table().select('id'),
|
||||
city_list : friends_table().distinct('city'),
|
||||
};
|
||||
|
||||
for ( key_name in taffy_map ){
|
||||
if ( taffy_map.hasOwnProperty(key_name) ){
|
||||
data_val = taffy_map[key_name];
|
||||
console.warn(key_name, data_val);
|
||||
if ( data_val.hasOwnProperty('get') ){
|
||||
console.warn(JSON.stringify(data_val.get()));
|
||||
}
|
||||
console.warn('----------------');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
Please open your javascript console to see test results
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
58
node_modules/taffydb/taffy.js
generated
vendored
58
node_modules/taffydb/taffy.js
generated
vendored
@ -33,9 +33,7 @@ var TAFFY, exports, T;
|
||||
version, TC, idpad, cmax,
|
||||
API, protectJSON, each, eachin,
|
||||
isIndexable, returnFilter, runFilters,
|
||||
numcharsplit, orderByCol, run, intersection,
|
||||
filter, makeCid, safeForJson,
|
||||
isRegexp
|
||||
numcharsplit, orderByCol, run
|
||||
;
|
||||
|
||||
|
||||
@ -43,7 +41,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.7';
|
||||
version = '2.6.2'; // proposed mmikowski 2012-08-06
|
||||
TC = 1;
|
||||
idpad = '000000';
|
||||
cmax = 1000;
|
||||
@ -63,44 +61,7 @@ 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;
|
||||
// ****************************************
|
||||
@ -320,10 +281,7 @@ var TAFFY, exports, T;
|
||||
r
|
||||
;
|
||||
|
||||
if (typeof mvalue === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ( (s.indexOf( '!' ) === 0) && s !== bangeq &&
|
||||
s !== bangeqeq )
|
||||
{
|
||||
@ -358,8 +316,7 @@ var TAFFY, exports, T;
|
||||
? mvalue.toLowerCase() === mtest.toLowerCase()
|
||||
: mvalue === mtest) : (s === 'has')
|
||||
? (T.has( mvalue, mtest )) : (s === 'hasall')
|
||||
? (T.hasAll( mvalue, mtest )) : (s === 'contains')
|
||||
? (TAFFY.isArray(mvalue) && mvalue.indexOf(mtest) > -1) : (
|
||||
? (T.hasAll( mvalue, mtest )) : (
|
||||
s.indexOf( 'is' ) === -1
|
||||
&& !TAFFY.isNull( mvalue )
|
||||
&& !TAFFY.isUndefined( mvalue )
|
||||
@ -850,7 +807,7 @@ var TAFFY, exports, T;
|
||||
run.call( that );
|
||||
each( arguments, function ( c ) {
|
||||
each( that.context().results, function ( r ) {
|
||||
total = total + (r[c] || 0);
|
||||
total = total + r[c];
|
||||
});
|
||||
});
|
||||
return total;
|
||||
@ -1445,7 +1402,7 @@ var TAFFY, exports, T;
|
||||
}
|
||||
});
|
||||
if ( cid === '' ){
|
||||
cid = makeCid( T.mergeObj( context,
|
||||
cid = JSON.stringify( T.mergeObj( context,
|
||||
{q : false, run : false, sort : false} ) );
|
||||
}
|
||||
}
|
||||
@ -1775,7 +1732,7 @@ var TAFFY, exports, T;
|
||||
// ****************************************
|
||||
TAFFY.has = function ( var1, var2 ) {
|
||||
|
||||
var re = false, n;
|
||||
var re = true, n;
|
||||
|
||||
if ( (var1.TAFFY) ){
|
||||
re = var1( var2 );
|
||||
@ -1843,7 +1800,6 @@ 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 ){
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
"marked": "~0.3.2",
|
||||
"requizzle": "~0.2.0",
|
||||
"strip-json-comments": "~1.0.2",
|
||||
"taffydb": "~2.7.2",
|
||||
"taffydb": "https://github.com/hegemonic/taffydb/tarball/7d100bcee0e997ee4977e273cdce60bd8933050e",
|
||||
"underscore": "~1.7.0",
|
||||
"wrench": "~1.5.8"
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user