Skip to content

Commit

Permalink
Rename underscore.db to underscore-db
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Sep 18, 2014
1 parent 6d53521 commit 166cef6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Underscore.db [![Build Status](https://travis-ci.org/typicode/underscore.db.svg)](https://travis-ci.org/typicode/underscore.db) [![NPM version](https://badge.fury.io/js/underscore.db.svg)](http://badge.fury.io/js/underscore.db) [![Bower version](https://badge.fury.io/bo/underscore.db.svg)](http://badge.fury.io/bo/underscore.db)
# Underscore-db [![Build Status](https://travis-ci.org/typicode/underscore-db.svg)](https://travis-ci.org/typicode/underscore-db) [![NPM version](https://badge.fury.io/js/underscore-db.svg)](http://badge.fury.io/js/underscore-db) [![Bower version](https://badge.fury.io/bo/underscore-db.svg)](http://badge.fury.io/bo/underscore-db)

> Adds functions to Underscore/Lo-Dash for manipulating database-like objects.
Expand All @@ -15,37 +15,37 @@ It adds:

Data can be persisted using the filesystem or localStorage.

__[Live example](http://typicode.github.io/underscore.db/)__
__[Live example](http://typicode.github.io/underscore-db/)__

_For a full JSON database built on Lo-Dash and Underscore.db, check [LowDB](https://github.com/typicode/lowdb)._
_For a full JSON database built on Lo-Dash and Underscore-db, check [LowDB](https://github.com/typicode/lowdb)._

## Install

__Node__

```bash
$ npm install underscore underscore.db
$ npm install underscore underscore-db
```

```javascript
var _ = require('underscore');
var _db = require('underscore.db');
var _db = require('underscore-db');

_.mixin(_db);
```

__Browser__

```bash
$ bower install underscore underscore.db
$ bower install underscore underscore-db
```

```html
<script src="underscore.js" type="text/javascript"></script>
<script src="underscore.db.js" type="text/javascript"></script>
<script src="underscore-db.js" type="text/javascript"></script>
```

To use Underscore.db with Lo-Dash, just replace `underscore` with `lodash`
To use Underscore-db with Lo-Dash, just replace `underscore` with `lodash`

## Usage example

Expand Down Expand Up @@ -73,7 +73,7 @@ Display database `console.log(db)`
}
```

Retrieve post using underscore.db `get` or underscore `find` method
Retrieve post using underscore-db `get` or underscore `find` method

```javascript
var post = _.get(db.posts, newPost.id);
Expand Down Expand Up @@ -191,7 +191,7 @@ _.id = '_id';

__createId(collectionName, doc)__

Called by Underscore.db when a document is inserted. Overwrite it if you want to change id generation algorithm.
Called by Underscore-db when a document is inserted. Overwrite it if you want to change id generation algorithm.

```javascript
_.createId = function(collectionName, doc) {
Expand Down Expand Up @@ -232,7 +232,7 @@ var topFivePosts = _(db.posts)

With Lo-Dash, you can create optimal builds and include just what you need.

Minimal build for Underscore.db to work (~2kb min gzipped):
Minimal build for Underscore-db to work (~2kb min gzipped):

```bash
$ npm install -g lodash-cli
Expand All @@ -243,8 +243,8 @@ For more build options, see http://lodash.com/custom-builds.

## Changelog

See details changes for each version in the [release notes](https://github.com/typicode/underscore.db/releases).
See details changes for each version in the [release notes](https://github.com/typicode/underscore-db/releases).

## License

Underscore.db is released under the MIT License.
Underscore-db is released under the MIT License.
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "underscore.db",
"main": "dist/underscore.db.js",
"name": "underscore-db",
"main": "dist/underscore-db.js",
"version": "0.8.0",
"homepage": "https://github.com/typicode/underscore.db",
"homepage": "https://github.com/typicode/underscore-db",
"authors": [
"Typicode <typicode@gmail.com>"
],
Expand Down
6 changes: 5 additions & 1 deletion dist/underscore.db.js → dist/underscore-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ module.exports = {
},

insert: function(collection, doc) {
doc[this.__id()] = doc[this.__id()] || this.createId(collection, doc);
if (doc[this.__id()]) {
this.remove(collection, doc[this.__id()]);
} else {
doc[this.__id()] = this.createId(collection, doc);
}

collection.push(doc);

Expand Down
4 changes: 2 additions & 2 deletions dist/underscore.db.min.js → dist/underscore-db.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "underscore.db",
"name": "underscore-db",
"version": "0.8.0",
"description": "Use JavaScript objects as databases",
"main": "src/node.js",
Expand All @@ -10,7 +10,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/typicode/underscore.db.git"
"url": "https://github.com/typicode/underscore-db.git"
},
"keywords": [
"JavaScript",
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ var assert = require('assert'),
fs = require('fs'),
_db = require('../src/node');

// Test underscore.db against Undersocre and Lo-Dash
// Test underscore-db against Undersocre and Lo-Dash
var libs = {
underscore: require('underscore'),
lodash: require('lodash')
};

Object.keys(libs).forEach(function(name) {

describe(name + ' + underscore.db', function() {
describe(name + ' + underscore-db', function() {

var db;
var _ = libs[name];
Expand Down

0 comments on commit 166cef6

Please sign in to comment.