Comparing version 0.2.1 to 0.2.2
@@ -123,3 +123,3 @@ 'use strict'; | ||
if (insertedInResult) { | ||
this.update(); | ||
return this.update(); | ||
} | ||
@@ -126,0 +126,0 @@ } |
@@ -11,6 +11,9 @@ 'use strict'; | ||
bundleMinName: 'marsdb.min.js', | ||
bundlePolyName: 'marsdb.polyfills.js', | ||
entry: 'lib/Collection', | ||
bundlePolyfillsName: 'marsdb.polyfills.js', | ||
bundleAngularName: 'marsdb.angular.js', | ||
entry: 'browser.js', | ||
entryTests: 'browser_tests.js', | ||
entryPolyfills: 'browser_polyfills.js', | ||
entryAngular: 'dist/angular/index', | ||
} | ||
}; |
@@ -18,2 +18,3 @@ 'use strict'; | ||
'build:browser', | ||
'build:browser:angular', | ||
'build:browser:min', | ||
@@ -49,10 +50,9 @@ 'build:browser:tests', | ||
var customOpts = { | ||
entries: './browser_polyfills.js', | ||
entries: config.browser.entryPolyfills, | ||
debug: false, | ||
fullPaths: false, | ||
delay: 50 | ||
fullPaths: false | ||
}; | ||
return browserify(customOpts).bundle() | ||
.pipe(source(config.browser.bundlePolyName)) | ||
.pipe(source(config.browser.bundlePolyfillsName)) | ||
.pipe(buffer()) | ||
@@ -63,3 +63,19 @@ .pipe(uglify()) | ||
gulp.task('build:browser:tests', function() { | ||
gulp.task('build:browser:angular', ['build:node'], function() { | ||
var customOpts = { | ||
entries: config.browser.entryAngular, | ||
debug: false, | ||
fullPaths: false, | ||
bundleExternal: false | ||
}; | ||
return browserify(customOpts) | ||
.bundle() | ||
.pipe(source(config.browser.bundleAngularName)) | ||
.pipe(buffer()) | ||
.pipe(uglify()) | ||
.pipe(gulp.dest(config.build)) | ||
}); | ||
gulp.task('build:browser:tests', ['build:node'], function() { | ||
// Basic options | ||
@@ -102,30 +118,12 @@ var customOpts = { | ||
gulp.task('build:browser', function() { | ||
// Basic options | ||
var customOpts = { | ||
entries: './lib/Collection', | ||
gulp.task('build:browser', ['build:node'], function() { | ||
var b = browserify({ | ||
entries: config.browser.entry, | ||
debug: false, | ||
fullPaths: false, | ||
delay: 50, | ||
standalone: 'Mars.Collection' | ||
}; | ||
var b = browserify(customOpts); | ||
standalone: 'Mars' | ||
}); | ||
// Transformations | ||
var transforms = [ | ||
babelify.configure({ | ||
comments: true, | ||
compact: false, | ||
blacklist: [ | ||
'spec.functionName', | ||
], | ||
optional: [ | ||
'es7.trailingFunctionCommas', | ||
] | ||
}), | ||
'brfs', | ||
'bulkify', | ||
'envify' | ||
]; | ||
var transforms = ['brfs', 'bulkify', 'envify']; | ||
transforms.forEach(function(transform) { | ||
@@ -135,3 +133,2 @@ b.transform(transform); | ||
// Add handlers | ||
return b.bundle() | ||
@@ -138,0 +135,0 @@ .pipe(source(config.browser.bundleName)) |
@@ -1,3 +0,1 @@ | ||
var Collection = require('./dist/Collection'); | ||
module.exports = Collection; | ||
module.exports = require('./dist/Collection'); |
@@ -78,3 +78,3 @@ import Cursor from './Cursor'; | ||
if (insertedInResult) { | ||
this.update(); | ||
return this.update(); | ||
} | ||
@@ -81,0 +81,0 @@ } |
{ | ||
"name": "marsdb", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"author": { | ||
@@ -36,2 +36,4 @@ "name": "Artem Artemev", | ||
"devDependencies": { | ||
"angular": "^1.4.7", | ||
"angular-mocks": "^1.4.7", | ||
"babel": "^5.8.23", | ||
@@ -73,3 +75,4 @@ "babel-eslint": "^4.1.1", | ||
"main": "index", | ||
"browser": "browser", | ||
"license": "MIT" | ||
} |
<div style="text-align:center"><img src="https://static.studytime.me/marsdb.png" /></div> | ||
MarsDB | ||
========= | ||
[![Build Status](https://travis-ci.org/c58/marsdb.svg?branch=master)](https://travis-ci.org/c58/marsdb) [![npm version](https://badge.fury.io/js/marsdb.svg)](https://www.npmjs.com/package/marsdb) [![Coverage Status](https://coveralls.io/repos/c58/marsdb/badge.svg?branch=master&service=github)](https://coveralls.io/github/c58/marsdb?branch=master) [![Dependency Status](https://david-dm.org/c58/marsdb.svg)](https://david-dm.org/c58/marsdb) | ||
[![Build Status](https://travis-ci.org/c58/marsdb.svg?branch=master)](https://travis-ci.org/c58/marsdb) | ||
[![npm version](https://badge.fury.io/js/marsdb.svg)](https://www.npmjs.com/package/marsdb) | ||
[![Coverage Status](https://coveralls.io/repos/c58/marsdb/badge.svg?branch=master&service=github)](https://coveralls.io/github/c58/marsdb?branch=master) | ||
[![Dependency Status](https://david-dm.org/c58/marsdb.svg)](https://david-dm.org/c58/marsdb) | ||
MarsDB is a lightweight client-side database. | ||
@@ -17,3 +21,3 @@ It based on a Meteor’s `minimongo` mathing/modifying implementation. It carefully written on `ES6`, usess `modular lodash`, have a `Promise` based interface and may be backed with any storage implementation (LevelUP, LocalStorage, IndexDB, etc). It also supports `observable` cursors. | ||
* **Carefully written on ES6** | ||
* **Supports many of MeteorDB query/modify operations** – thanks to Meteor’s minimongo | ||
* **Supports many of MongoDB query/modify operations** – thanks to Meteor’s minimongo | ||
* **Flexible pipeline** – map, reduce, custom sorting function, filtering. All with a sexy JS interface (no ugly mongo’s aggregation language) | ||
@@ -40,7 +44,7 @@ * **Joinable cursor** – joining one object with another can’t be simplier | ||
const users = new Colelction(‘users’); | ||
const users = new Collection(‘users’); | ||
``` | ||
### Find a documents | ||
```javascript | ||
const posts = new Colelction(‘posts’); | ||
const posts = new Collection(‘posts’); | ||
posts.find({author: ‘Bob’}) | ||
@@ -55,3 +59,3 @@ .sort([‘createdAt’]) | ||
```javascript | ||
const posts = new Colelction(‘posts’); | ||
const posts = new Collection(‘posts’); | ||
posts.find() | ||
@@ -63,3 +67,3 @@ .limit(10) | ||
.reduce((acum, val) => acum + val) | ||
.thene(result => { | ||
.then(result => { | ||
// result is a sum of coutn of comments | ||
@@ -73,3 +77,3 @@ // in all found posts | ||
```javascript | ||
const posts = new Colelction(‘posts’); | ||
const posts = new Collection(‘posts’); | ||
const stopper = posts.find({tags: {$in: [‘marsdb’, ‘is’, ‘awesome’]}}) | ||
@@ -88,4 +92,4 @@ .observe(docs => { | ||
```javascript | ||
const users = new Colelction(‘users’); | ||
const posts = new Colelction(‘posts’); | ||
const users = new Collection(‘users’); | ||
const posts = new Collection(‘posts’); | ||
posts.find() | ||
@@ -96,2 +100,3 @@ .join(doc => { | ||
doc.authorObj = user; | ||
return doc; | ||
}); | ||
@@ -102,2 +107,6 @@ }) | ||
doc.another = _cached_data_by_post[doc._id]; | ||
// You need to return a document, bacause it's | ||
// a pipeline operation | ||
return doc; | ||
}); | ||
@@ -107,3 +116,3 @@ ``` | ||
```javascript | ||
const posts = new Colelction(‘posts’); | ||
const posts = new Collection(‘posts’); | ||
posts.insert({text: ‘MarsDB is awesome’}).then(docId => { | ||
@@ -122,3 +131,3 @@ // Invoked after persisting document | ||
```javascript | ||
const posts = new Colelction(‘posts’); | ||
const posts = new Collection(‘posts’); | ||
posts.update( | ||
@@ -135,3 +144,3 @@ {authorId: {$in: [1, 2, 3]}}, | ||
```javascript | ||
const posts = new Colelction(‘posts’); | ||
const posts = new Collection(‘posts’); | ||
posts.remove({authorId: {$in: [1,2,3]}}) | ||
@@ -138,0 +147,0 @@ .then(removedDocs => { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1001294
92
23251
153
29
4
13