Skip to content

Candidate 2.8.0 - cleaned up to pass jslint #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
70dd62f
Candidate 2.8.0 - cleaned up to pass jslint
aisera-mikowski Jun 17, 2015
6463e85
Removed console log messages
aisera-mikowski Jun 19, 2015
b353dfe
Changes to fix ios9 bug taffydb/pull/101
aisera-mikowski Oct 20, 2015
4903a49
Employed requests 101 and 97
aisera-mikowski Oct 20, 2015
08741c7
Merge branch 'ltullman-master' Issue 101 iOS9 compatibility
aisera-mikowski Oct 22, 2015
964ba9c
Merge branch 'master' of github.com:mmikowski/taffydb into mmikowski-…
aisera-mikowski Oct 22, 2015
9286afc
Updated tests to check for regressions
aisera-mikowski Oct 22, 2015
82964a3
Updated minified to latest source; passes regression tests
aisera-mikowski Oct 22, 2015
0561c21
Upgraded test framework and README.md
aisera-mikowski Oct 23, 2015
73e0fd8
Updated .gitignore, merged node info to readme
aisera-mikowski Oct 23, 2015
e2c483c
Minor typo in README
aisera-mikowski Oct 23, 2015
b49e983
Doubled regression tests and make more flexible, added jslint
aisera-mikowski Oct 24, 2015
c1d2ff4
Merge branch 'master' of github.com:mmikowski/taffydb into mmikowski-…
mmikowski Oct 24, 2015
4fc5d38
Removed taffy-min.js, as this is just confusing
mmikowski Oct 24, 2015
1769e4b
Added developer dependencies, fixed package.json
mmikowski Oct 24, 2015
22ecc2f
Created install_dev.sh
mmikowski Oct 25, 2015
9516c75
Updated README.md
mmikowski Oct 25, 2015
a283b3b
Fixed line endings to Unix
mmikowski Oct 25, 2015
cc42f0d
Merged nodeunit and readme from master
mmikowski Nov 27, 2015
8c97cfe
Updated install_dev.sh
aisera-mikowski Jan 7, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/*
node_modules
bin
134 changes: 101 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,140 @@
# TaffyDB (taffy.js)
# TaffyDB (taffy.js) - mmikowski fork

TaffyDB is an opensouce library that brings database features into your JavaScript applications.
TaffyDB is an open source JavaScript library that provides powerful
in-memory database capabilities to both browser and server applications.

## Fork notes

### 2.x.0
- Adjusted to pass jslint and employ some best practice

## 2.x.1 - updated regression tests, ported iOS9 fix from
- Updated tests to check for regressions
- Made tests easy to expand
- Added iOS9 fixes per https://github.com/typicaljoe/taffydb/pull/101/files

## 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.
Have 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 looks a lot like a database table? We did too.
We created TaffyDB easily and efficiently manipulate these 'tables'
with a uniform and familiar SQL-like interface.

We use TaffyDB instead of ad-hoc data manipulation routines throughout
our applications. This reduces development time, improves performance,
simplifies maintenance, *and* increases quality.

## What makes it sticky

- Extremely fast
- Powerful JavaScript centric data selection engine
- Database inspired features such as insert, update, unique, count, etc
- Powerful JavaScript-centric data selection engine
- SQL inspired features such as insert, update, unique, count, and more
- 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 a JSON array:

Just pass in JSON:
var product_db = TAFFY([
{ "item" : 1,
"name" : "Blue Ray Player",
"price" : 99.99
},
{ "item" : 2,
"name" : "3D TV",
"price" : 1799.99
}
]);

var products = TAFFY([{
"item":1,
"name":"Blue Ray Player",
"price":99.99
}, {
"item":2,
name:"3D TV",
price:1799.99
}]);
## Example queries

// where item is equal to 1
var item1 = products({item:1});

## Find data
// where price is less than 100
var lowPricedItems = products({price:{lt:100}});

Use JSON to compare:
// where name is like "Blue Ray"
var blueRayPlayers = products({name:{like:"Blue Ray"}});

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"
// get first record
products().first();

// get last record
products().last();

## Use data
## Example record manipulation

// 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
// Inject values from a record into a string template.
// Row value will be set to "<tr><td>3D TV</td><td>17999.99</td></tr>"
var row = products({item:2})
.supplant("<tr><td>{name}</td><td>{price}</td></tr>");

## Use it in Node.JS
Node is easy to use in Node.JS. Simply install using `npm` and `require` the
package:

$ npm install --production taffy

# and then in your code
TAFFY = require( 'taffy' ).taffy;

The automated regression test file `nodeunit_suite.js` is an excellent
example.

## Help improve taffydb

TaffyDB has been used and refined for years for numerous production tools and
commercial products. It is therefore is quite stable and reliable. However,
we want expand our regression test coverage so we can easily improve the code
with the confidence that we are unlikely to break exising capabilities.

### Getting started with development

Run the `install_dev.sh` script to install development utilities such as `jslint`,
`nodeunit`, and `uglifyjs` to the `bin` directory.

./install_dev.sh


### Running regression tests
Running the nodeunit regression test suite is simple:

cd taffydb
./install_dev.sh # as above

bin/nodeunit ./nodeunit_suite.js

Please do not send a pull request unless your changes have passed these
tests. We check, you know :)

### Adding to regression tests
We wish to substantially expand the number of tests, and your
help is welcome! The code, `nodeunit_suite.js`, should be easy to adjust.
Pull requests that include regression test inclusions are very much
appreciated. Alternately, if you just send along a test scenario, we'd be
happy to include it in the suite, time permitting.

## 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.
Expand Down
Empty file removed how-to-node.md
Empty file.
48 changes: 48 additions & 0 deletions install_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

echo "Install developer libraries?"
echo " WARNING: this will remove the following directories:"
echo " node_modules"
echo " bin"
echo " It will then install the taffydb node libraries"
echo " and create symbolic links in the bin directory"
echo " to the utilities used for taffydb development."
echo
echo " If you do not want this, press CTRL+C NOW!"
echo " Otherwise, press return."
echo

read LINE;

echo "Removing directories ..."
rm -rf node_modules bin;

echo "Installing taffydb developer dependencies..."
node -e '
var devMap=require("./package.json").devDependencies;
Object.keys(devMap).map(
function(key){ console.log( key + "@" + devMap[ key ] ) }
);' | xargs npm install;

echo "Creating symbolic links ..."
mkdir bin;
cd bin
ln -s ../node_modules/jslint/bin/jslint.js jslint;
ln -s ../node_modules/nodeunit/bin/nodeunit nodeunit;
ln -s ../node_modules/uglifyjs/bin/uglifyjs uglifyjs;
cd ../

echo
echo "Done. Installed utilities are below:"
ls -1 bin;
echo

echo "Running regression tests"
echo
bin/nodeunit nodeunit_suite.js

echo
echo "Happy taffydb development!"
echo

exit 0;
99 changes: 0 additions & 99 deletions node-demo.js

This file was deleted.

Loading