Comparing version 0.6.12 to 0.6.13
@@ -22,8 +22,5 @@ "use strict"; | ||
var util = require("./util"); | ||
var is = require("is_js"); | ||
var isFunction = require("lodash.isfunction"); | ||
var isObject = require("lodash.isobject"); | ||
var isArray = require("lodash.isarray"); | ||
/** | ||
@@ -142,3 +139,3 @@ * Mongorito | ||
// iterate and call set on each item | ||
if (isObject(key)) { | ||
if (is.object(key)) { | ||
var _ret = (function () { | ||
@@ -181,3 +178,3 @@ var attrs = key; | ||
if (undefined == actualValue) { | ||
if (is.undefined(actualValue)) { | ||
_this.set(key, defaultValue); | ||
@@ -196,3 +193,3 @@ } | ||
var _this = this; | ||
if (isObject(when)) { | ||
if (is.object(when)) { | ||
var _ret = (function () { | ||
@@ -224,3 +221,3 @@ var hooks = when; | ||
if (isArray(method)) { | ||
if (is.array(method)) { | ||
var _methods = method; | ||
@@ -235,5 +232,5 @@ | ||
if (false === isFunction(method)) method = this[method]; | ||
if (is.not["function"](method)) method = this[method]; | ||
if ("around" === when) { | ||
if (when === "around") { | ||
this._hooks.before[action].push(method); | ||
@@ -270,3 +267,3 @@ this._hooks.after[action].unshift(method); | ||
if (skip) { | ||
if (typeof skip === "string") skip = [skip]; | ||
if (is.string(skip)) skip = [skip]; | ||
@@ -296,3 +293,3 @@ hooks = hooks.filter(function (fn) { | ||
if (isArray(value)) { | ||
if (is.array(value)) { | ||
value = value.map(function (doc) { | ||
@@ -299,0 +296,0 @@ return doc.get("_id"); |
@@ -9,6 +9,3 @@ "use strict"; | ||
var isRegExp = require("lodash.isregexp"); | ||
var isObject = require("lodash.isobject"); | ||
var isString = require("lodash.isstring"); | ||
var isArray = require("lodash.isarray"); | ||
var is = require("is_js"); | ||
@@ -40,3 +37,3 @@ var util = require("./util"); | ||
// iterate over that object and call .where(key, value) | ||
if (isObject(key)) { | ||
if (is.object(key)) { | ||
(function () { | ||
@@ -52,7 +49,7 @@ var conditions = key; | ||
if (isString(key)) { | ||
if (is.string(key)) { | ||
// if only one argument was supplied | ||
// save the key in this.lastKey | ||
// for future methods, like .equals() | ||
if (undefined == value) { | ||
if (is.undefined(value)) { | ||
this.lastKey = key; | ||
@@ -64,5 +61,5 @@ return this; | ||
// 2. if object and not ObjectID | ||
if (isRegExp(value)) { | ||
if (is.regexp(value)) { | ||
value = { $regex: value }; | ||
} else if (isObject(value) && false === isObjectID(value)) { | ||
} else if (is.object(value) && !isObjectID(value)) { | ||
value = { $elemMatch: value }; | ||
@@ -160,3 +157,3 @@ } | ||
// if value is an array of IDs, loop through it | ||
if (isArray(value)) { | ||
if (is.array(value)) { | ||
// convert each _id | ||
@@ -232,3 +229,3 @@ // to findById op | ||
Query.prototype[method] = function () { | ||
var args = isArray(arguments[0]) ? arguments[0] : Array.from(arguments); | ||
var args = is.array(arguments[0]) ? arguments[0] : Array.from(arguments); | ||
@@ -235,0 +232,0 @@ this.query["$" + method] = args; |
@@ -14,8 +14,5 @@ /** | ||
var util = require('./util'); | ||
var is = require('is_js'); | ||
var isFunction = require('lodash.isfunction'); | ||
var isObject = require('lodash.isobject'); | ||
var isArray = require('lodash.isarray'); | ||
/** | ||
@@ -131,3 +128,3 @@ * Mongorito | ||
// iterate and call set on each item | ||
if (isObject(key)) { | ||
if (is.object(key)) { | ||
let attrs = key; | ||
@@ -159,3 +156,3 @@ let keys = Object.keys(attrs); | ||
if (undefined == actualValue) { | ||
if (is.undefined(actualValue)) { | ||
this.set(key, defaultValue); | ||
@@ -175,3 +172,3 @@ } | ||
hook (when, action, method) { | ||
if (isObject(when)) { | ||
if (is.object(when)) { | ||
let hooks = when; | ||
@@ -190,3 +187,3 @@ let keys = Object.keys(hooks); | ||
if (isArray(method)) { | ||
if (is.array(method)) { | ||
let methods = method; | ||
@@ -199,5 +196,5 @@ | ||
if (false === isFunction(method)) method = this[method]; | ||
if (is.not.function(method)) method = this[method]; | ||
if ('around' === when) { | ||
if (when === 'around') { | ||
this._hooks.before[action].push(method); | ||
@@ -233,7 +230,5 @@ this._hooks.after[action].unshift(method); | ||
if (skip) { | ||
if (typeof skip === 'string') skip = [skip]; | ||
if (is.string(skip)) skip = [skip]; | ||
hooks = hooks.filter(function (fn) { | ||
return skip.indexOf(fn.name) === -1; | ||
}); | ||
hooks = hooks.filter(fn => skip.indexOf(fn.name) === -1); | ||
} | ||
@@ -258,3 +253,3 @@ | ||
if (isArray(value)) { | ||
if (is.array(value)) { | ||
value = value.map(doc => doc.get('_id')); | ||
@@ -261,0 +256,0 @@ } else { |
@@ -5,6 +5,3 @@ /** | ||
var isRegExp = require('lodash.isregexp'); | ||
var isObject = require('lodash.isobject'); | ||
var isString = require('lodash.isstring'); | ||
var isArray = require('lodash.isarray'); | ||
var is = require('is_js'); | ||
@@ -32,3 +29,3 @@ var util = require('./util'); | ||
// iterate over that object and call .where(key, value) | ||
if (isObject(key)) { | ||
if (is.object(key)) { | ||
let conditions = key; | ||
@@ -40,7 +37,7 @@ let keys = Object.keys(conditions); | ||
if (isString(key)) { | ||
if (is.string(key)) { | ||
// if only one argument was supplied | ||
// save the key in this.lastKey | ||
// for future methods, like .equals() | ||
if (undefined == value) { | ||
if (is.undefined(value)) { | ||
this.lastKey = key; | ||
@@ -52,5 +49,5 @@ return this; | ||
// 2. if object and not ObjectID | ||
if (isRegExp(value)) { | ||
if (is.regexp(value)) { | ||
value = { $regex: value }; | ||
} else if (isObject(value) && false === isObjectID(value)) { | ||
} else if (is.object(value) && !isObjectID(value)) { | ||
value = { $elemMatch: value }; | ||
@@ -148,3 +145,3 @@ } | ||
// if value is an array of IDs, loop through it | ||
if (isArray(value)) { | ||
if (is.array(value)) { | ||
// convert each _id | ||
@@ -223,3 +220,3 @@ // to findById op | ||
Query.prototype[method] = function () { | ||
let args = isArray(arguments[0]) ? arguments[0] : Array.from(arguments); | ||
let args = is.array(arguments[0]) ? arguments[0] : Array.from(arguments); | ||
@@ -226,0 +223,0 @@ this.query['$' + method] = args; |
{ | ||
"name": "mongorito", | ||
"version": "0.6.12", | ||
"version": "0.6.13", | ||
"description": "ES6 generator-based MongoDB ODM. It rocks.", | ||
@@ -9,8 +9,4 @@ "author": "Vadim Demedes <vdemedes@gmail.com>", | ||
"co-monk": "^1.0.0", | ||
"is_js": "^0.7.1", | ||
"koa-compose": "^2.3.0", | ||
"lodash.isarray": "^3.0.0", | ||
"lodash.isfunction": "^3.0.1", | ||
"lodash.isobject": "^3.0.0", | ||
"lodash.isregexp": "^3.0.0", | ||
"lodash.isstring": "^3.0.0", | ||
"lodash.result": "^3.0.0", | ||
@@ -17,0 +13,0 @@ "monk": "^0.9.1", |
7
35238
1091
+ Addedis_js@^0.7.1
+ Addedis_js@0.7.6(transitive)
- Removedlodash.isarray@^3.0.0
- Removedlodash.isfunction@^3.0.1
- Removedlodash.isobject@^3.0.0
- Removedlodash.isregexp@^3.0.0
- Removedlodash.isstring@^3.0.0
- Removedlodash.isobject@3.0.2(transitive)
- Removedlodash.isregexp@3.0.5(transitive)
- Removedlodash.isstring@3.0.1(transitive)