Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Commit

Permalink
use native Array.isArray instead of is_js
Browse files Browse the repository at this point in the history
  • Loading branch information
vdemedes committed Feb 21, 2016
1 parent 12c7e81 commit c69f400
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/mongorito.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ Model.prototype.hook = function (when, action, method) {
// if array is given
// iterate and call .hook()
// for each item
if (is.array(method)) {
if (Array.isArray(method)) {
let methods = method;

methods.forEach(function (method) {
Expand Down Expand Up @@ -524,7 +524,7 @@ Model.prototype.save = function (options) {
keys.forEach(function (key) {
let value = self.get(key);

if (is.array(value)) {
if (Array.isArray(value)) {
value = value.map(function (doc) {
return doc.get('_id');
});
Expand Down
8 changes: 4 additions & 4 deletions lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Query.prototype.match = function () {
Query.prototype.include = function (key, value) {
let self = this;

if (is.array(key)) {
if (Array.isArray(key)) {
let fields = key;

fields.forEach(function (key) {
Expand Down Expand Up @@ -142,7 +142,7 @@ Query.prototype.include = function (key, value) {
Query.prototype.exclude = function (key, value) {
let self = this;

if (is.array(key)) {
if (Array.isArray(key)) {
let fields = key;

fields.forEach(function (key) {
Expand Down Expand Up @@ -339,7 +339,7 @@ Query.prototype.find = function (query, options) {
let childModel = options.populate[key];
let value = doc[key];

if (is.array(value)) {
if (Array.isArray(value)) {
value = Promise.map(value, function (id) {
return childModel.findById(id);
});
Expand Down Expand Up @@ -438,7 +438,7 @@ methods.forEach(function (method) {
// or, nor and and share the same imlpementation
['or', 'nor', 'and'].forEach(function (method) {
Query.prototype[method] = function () {
let args = is.array(arguments[0]) ? arguments[0] : Array.prototype.slice.call(arguments);
let args = Array.isArray(arguments[0]) ? arguments[0] : Array.prototype.slice.call(arguments);
let operator = '$' + method;

this.query[operator] = args;
Expand Down

0 comments on commit c69f400

Please sign in to comment.