New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mongorito

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongorito - npm Package Compare versions

Comparing version 0.6.5 to 0.6.6

test.js

74

build/mongorito.js
"use strict";
var _slicedToArray = function (arr, i) { if (Array.isArray(arr)) { return arr; } else { var _arr = []; for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); if (i && _arr.length === i) break; } return _arr; } };
var _slicedToArray = function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { var _arr = []; for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); if (i && _arr.length === i) break; } return _arr; } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } };

@@ -15,2 +15,4 @@ var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };

var Class = require("class-extend");
var pluralize = require("pluralize");
var compose = require("koa-compose");

@@ -65,13 +67,3 @@ var monk = require("monk");

Mongorito.collection = (function (_collection) {
var _collectionWrapper = function collection() {
return _collection.apply(this, arguments);
};
_collectionWrapper.toString = function () {
return _collection.toString();
};
return _collectionWrapper;
})(function (db, name) {
Mongorito.collection = function collection(db, name) {
var url = db.driver._connect_args[0];

@@ -84,7 +76,8 @@ var collections = this.collections[url];

if (collections[name]) return collections[name];
if (collections[name]) {
return collections[name];
}var collection = db.get(name);
return collections[name] = wrap(collection);
};
var collection = db.get(name);
return collections[name] = wrap(collection);
});
return Mongorito;

@@ -165,3 +158,5 @@ })();

if (typeof _ret === "object") return _ret.v;
if (typeof _ret === "object") {
return _ret.v;
}
}

@@ -221,3 +216,5 @@

if (typeof _ret === "object") return _ret.v;
if (typeof _ret === "object") {
return _ret.v;
}
}

@@ -343,3 +340,7 @@

Model.collection = function collection() {
Model._collection = function _collection() {
if (!this.prototype.collection) {
this.prototype.collection = pluralize(this.name).toLowerCase();
}
var name = this.prototype.collection;

@@ -356,3 +357,3 @@

Model.find = function* find(query) {
var collection = this.collection();
var collection = this._collection();
var model = this;

@@ -365,14 +366,4 @@

Model.count = (function (_count) {
var _countWrapper = function count() {
return _count.apply(this, arguments);
};
_countWrapper.toString = function () {
return _count.toString();
};
return _countWrapper;
})(function* (query) {
var collection = this.collection();
Model.count = function* count(query) {
var collection = this._collection();
var model = this;

@@ -383,3 +374,4 @@

return yield count;
});
};
Model.all = function* all() {

@@ -400,3 +392,3 @@ return yield this.find();

Model.remove = function* remove(query) {
var collection = this.collection();
var collection = this._collection();
var model = this;

@@ -410,3 +402,3 @@

Model.index = function* index() {
var collection = this.collection();
var collection = this._collection();

@@ -417,3 +409,3 @@ return yield collection.index.apply(collection, arguments);

Model.indexes = function* indexes() {
var collection = this.collection();
var collection = this._collection();

@@ -424,3 +416,3 @@ return yield collection.indexes();

Model.id = function id() {
var collection = this.collection();
var collection = this._collection();

@@ -433,2 +425,8 @@ return collection.id.apply(collection, arguments);

get: function () {
if (!this.collection) {
var _constructor = this.constructor;
this.collection = _constructor.prototype.collection = pluralize(_constructor.name).toLowerCase();
}
return Mongorito.collection(this._db, this.collection);

@@ -456,3 +454,3 @@ },

Model[method] = function () {
var collection = this.collection();
var collection = this._collection();
var model = this;

@@ -459,0 +457,0 @@

@@ -117,13 +117,3 @@ "use strict";

Query.prototype.count = (function (_count) {
var _countWrapper = function count() {
return _count.apply(this, arguments);
};
_countWrapper.toString = function () {
return _count.toString();
};
return _countWrapper;
})(function* (query) {
Query.prototype.count = function* count(query) {
this.where(query);

@@ -137,3 +127,4 @@

return yield count;
});
};
Query.prototype.find = function* find(query) {

@@ -157,9 +148,9 @@ this.where(query);

var j = 0;
var _key = undefined;
var key = undefined;
while (_key = populate[j++]) {
while (key = populate[j++]) {
// model to use when populating the field
var childModel = options.populate[_key];
var childModel = options.populate[key];
var value = doc[_key];
var value = doc[key];

@@ -176,3 +167,3 @@ // if value is an array of IDs, loop through it

// replace previous ID with actual documents
doc[_key] = yield value;
doc[key] = yield value;
}

@@ -179,0 +170,0 @@

@@ -7,2 +7,4 @@ /**

var Class = require('class-extend');
var pluralize = require('pluralize');
var compose = require('koa-compose');

@@ -104,2 +106,8 @@ var monk = require('monk');

get _collection () {
if (!this.collection) {
let constructor = this.constructor;
this.collection = constructor.prototype.collection = pluralize(constructor.name).toLowerCase();
}
return Mongorito.collection(this._db, this.collection);

@@ -287,3 +295,7 @@ }

static collection () {
static _collection () {
if (!this.prototype.collection) {
this.prototype.collection = pluralize(this.name).toLowerCase();
}
let name = this.prototype.collection;

@@ -300,3 +312,3 @@

static * find (query) {
let collection = this.collection();
let collection = this._collection();
let model = this;

@@ -310,3 +322,3 @@

static * count (query) {
let collection = this.collection();
let collection = this._collection();
let model = this;

@@ -334,3 +346,3 @@

static * remove (query) {
let collection = this.collection();
let collection = this._collection();
let model = this;

@@ -344,3 +356,3 @@

static * index () {
let collection = this.collection();
let collection = this._collection();

@@ -351,3 +363,3 @@ return yield collection.index.apply(collection, arguments);

static * indexes () {
let collection = this.collection();
let collection = this._collection();

@@ -358,3 +370,3 @@ return yield collection.indexes();

static id () {
let collection = this.collection();
let collection = this._collection();

@@ -389,3 +401,3 @@ return collection.id.apply(collection, arguments);

Model[method] = function () {
let collection = this.collection();
let collection = this._collection();
let model = this;

@@ -392,0 +404,0 @@

{
"name": "mongorito",
"version": "0.6.5",
"version": "0.6.6",
"description": "ES6 generator-based MongoDB ODM. It rocks.",

@@ -10,6 +10,7 @@ "author": "Vadim Demedes <vdemedes@gmail.com>",

"koa-compose": "^2.3.0",
"monk": "^0.9.1"
"monk": "^0.9.1",
"pluralize": "^1.1.2"
},
"devDependencies": {
"6to5": "^3.0.8",
"babel": "^4.0.1",
"chai": "^1.10.0",

@@ -16,0 +17,0 @@ "chance": "^0.6.1",

@@ -44,3 +44,3 @@ # Mongorito

class Post extends Model {
get collection () { return 'posts'; }
}

@@ -47,0 +47,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc