Socket
Socket
Sign inDemoInstall

bookshelf

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bookshelf - npm Package Compare versions

Comparing version 0.6.4 to 0.6.5

test/integration/helpers/plugin.js

16

bookshelf.js

@@ -1,2 +0,2 @@

// Bookshelf.js 0.6.4
// Bookshelf.js 0.6.5
// ---------------

@@ -90,3 +90,3 @@

// Keep in sync with `package.json`.
VERSION: '0.6.4',
VERSION: '0.6.5',

@@ -100,13 +100,15 @@ // Helper method to wrap a series of Bookshelf actions in a `knex` transaction block;

// injecting the current instance into the plugin, which should be a module.exports.
plugin: function(plugin) {
plugin: function(plugin, options) {
if (_.isString(plugin)) {
try {
require('./plugins/' + plugin)(this);
require('./plugins/' + plugin)(this, options);
} catch (e) {
require(plugin)(this);
require(plugin)(this, options);
}
} else if (_.isArray(plugin)) {
_.each(plugin, this.plugin, this);
_.each(plugin, function (plugin) {
this.plugin(plugin, options);
}, this);
} else {
plugin(this);
plugin(this, options);
}

@@ -113,0 +115,0 @@ return this;

@@ -135,5 +135,5 @@ // Base Collection

// Convenience method for map, returning a `Promise.all` promise.
// Run "Promise.map" over the models
mapThen: function(iterator, context) {
return Promise.all(this.map(iterator, context));
return Promise.bind(context).thenReturn(this.models).map(iterator);
},

@@ -146,2 +146,7 @@

// Run "reduce" over the models in the collection.
reduceThen: function(iterator, initialValue, context) {
return Promise.bind(context).thenReturn(this.models).reduce(iterator, initialValue).bind();
},
fetch: function() {

@@ -148,0 +153,0 @@ return Promise.rejected('The fetch method has not been implemented');

@@ -159,3 +159,3 @@ // Base Model

var sync = this.sync(options);
options.query = sync.query
options.query = sync.query;

@@ -162,0 +162,0 @@ return Promise.bind(this).then(function() {

{
"name": "bookshelf",
"version": "0.6.4",
"version": "0.6.5",
"description": "A lightweight ORM for PostgreSQL, MySQL, and SQLite3, influenced by Backbone.js",
"main": "bookshelf.js",
"scripts": {
"test": "mocha -R spec test/index.js",
"test": "mocha --check-leaks -R spec test/index.js",
"doc": "groc -o docs --verbose dialects/base/collection.js dialects/**/*.js plugins/*.js bookshelf.js",

@@ -26,3 +26,3 @@ "release:patch": "git checkout master && export BOOKSHELF_DEV=0 && npm run-script test && npm run-script doc && git add . && git commit -m 'docs prep for release' && grunt release:patch",

"dependencies": {
"backbone": "~1.1.0",
"backbone": "1.1.0",
"inflection": "~1.2.x",

@@ -29,0 +29,0 @@ "trigger-then": "~0.1.1",

@@ -12,4 +12,4 @@ // Registry Plugin -

Bookshelf.model = function(name, ModelCtor) {
this._models = this._models || {};
if (ModelCtor) {
this._models = this._models || {};
this._models[name] = ModelCtor;

@@ -20,4 +20,4 @@ }

Bookshelf.collection = function(name, CollectionCtor) {
this._collections = this._collections || {};
if (CollectionCtor) {
this._collections = this._collections || {};
this._collections[name] = CollectionCtor;

@@ -24,0 +24,0 @@ }

@@ -66,2 +66,3 @@ var _ = require('lodash');

require('./integration/relations')(bookshelf);
require('./integration/plugin')(bookshelf);
require('./integration/plugins/virtuals')(bookshelf);

@@ -68,0 +69,0 @@ require('./integration/plugins/visibility')(bookshelf);

@@ -653,3 +653,3 @@ var _ = require('lodash');

equal(model.isNew(), false);
delete model.id;
model.set('id', null);
equal(model.isNew(), true);

@@ -656,0 +656,0 @@ });

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