You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

bookshelf-deep-changed-plugin

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bookshelf-deep-changed-plugin - npm Package Compare versions

Comparing version

to
1.0.4

@@ -7,6 +7,18 @@ 'use strict';

var _underscore = require('underscore');
var _lodash = require('lodash.isobject');
var _underscore2 = _interopRequireDefault(_underscore);
var _lodash2 = _interopRequireDefault(_lodash);
var _lodash3 = require('lodash.isstring');
var _lodash4 = _interopRequireDefault(_lodash3);
var _lodash5 = require('lodash.isundefined');
var _lodash6 = _interopRequireDefault(_lodash5);
var _lodash7 = require('lodash.isequal');
var _lodash8 = _interopRequireDefault(_lodash7);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -26,10 +38,10 @@

_underscore2.default.each(arguments, function (arg, index, args) {
if (!_underscore2.default.isString(arg)) {
Array.from(arguments).forEach(function (arg, index, args) {
if (!(0, _lodash4.default)(arg)) {
if (index !== args.length - 1) {
throw new Error('Expecting strings only. You can pass an \'Options\' parameter as the last argument. Position: ' + index + ', Given non-string argument: ' + arg);
} else if (_underscore2.default.isObject(arg)) {
throw new Error(`Expecting strings only. You can pass an 'Options' parameter as the last argument. Position: ${index}, Given non-string argument: ${arg}`);
} else if ((0, _lodash2.default)(arg)) {
options = arg;
} else {
throw new Error('Last argument can either be a string or an options object. Given last argument: ' + arg);
throw new Error(`Last argument can either be a string or an options object. Given last argument: ${arg}`);
}

@@ -43,7 +55,7 @@ return;

var previousValue = _this.previous(arg);
if (_underscore2.default.isUndefined(previousValue)) {
missing.push({ index: index, argument: arg });
if ((0, _lodash6.default)(previousValue)) {
missing.push({ index, argument: arg });
hasChanged.push(undefined); // we do not know.
} else {
hasChanged.push(!_underscore2.default.isEqual(previousValue, _this.get(arg)));
hasChanged.push(!(0, _lodash8.default)(previousValue, _this.get(arg)));
}

@@ -66,3 +78,3 @@ }

var argument = item.argument;
var areEqual = _underscore2.default.isEqual(previousModel.get(argument), _this.get(argument));
var areEqual = (0, _lodash8.default)(previousModel.get(argument), _this.get(argument));
hasChanged.splice(index, 1, !areEqual);

@@ -69,0 +81,0 @@ });

{
"name": "bookshelf-deep-changed-plugin",
"version": "1.0.3",
"version": "1.0.4",
"description": "Allows bookshelf models to check whether a value you save is different than the existing value in the database.",
"main": "dist/index.js",
"files": [
"dist",
"README.md"
"dist"
],

@@ -13,3 +12,5 @@ "keywords": [

"hasChanged",
"has changed",
"deepChanged",
"deep changed",
"plugin",

@@ -29,4 +30,4 @@ "compare values"

"engines": {
"node": ">=4",
"npm": ">=2"
"node": ">=4 <9",
"npm": ">=2 <6"
},

@@ -38,3 +39,3 @@ "scripts": {

"lint:fix": "eslint . --fix",
"test": "npm run build && nyc mocha --require babel-core/register --recursive -t 10000 --exit",
"test": "npm run lint && npm run build && cross-env DEBUG=\"* -babel\" NODE_ENV=test nyc mocha --recursive -t 10000 --exit",
"test:coveralls": "nyc --reporter=lcov --reporter=text-lcov npm test && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",

@@ -45,6 +46,9 @@ "prepublish": "npm run build"

"bluebird": ">=2 <4",
"bookshelf": ">=0.7 <0.11",
"knex": ">=0.7 <0.14",
"pg": ">= 2.11.2 < 3.0.0 || >= 3.6.4 < 4.0.0 || >= 4.5.7 < 5.0.0 || >= 5.2.1 < 6.0.0 || >= 6.0.5 < 6.1.0 || >= 6.1.6 < 6.2.0 || >= 6.2.5 < 6.3.0 || >= 6.3.3 < 6.4.0 || >= 6.4.2 < 7.0.0 || >= 7.0.2 < 7.1.0 || ^7.1.2",
"underscore": "^1"
"bookshelf": ">=0.7 <0.13",
"knex": ">=0.7 <0.15",
"lodash.isequal": "^4.5.0",
"lodash.isobject": "^3.0.2",
"lodash.isstring": "^4.0.1",
"lodash.isundefined": "^3.0.1",
"pg": "^7.4.1"
},

@@ -54,17 +58,31 @@ "devDependencies": {

"babel-core": "^6.26.0",
"babel-plugin-istanbul": "^4.1.5",
"babel-preset-env": "^1.6.0",
"chai": "^4.1.2",
"chance": "^1.0.11",
"chance": "^1.0.13",
"coveralls": "^3.0.0",
"eslint": "^4.8.0",
"cross-env": "^5.1.3",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-mocha": "^4.11.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"mocha": "^4.0.1",
"nyc": "^11.2.1",
"mocha": "^4.1.0",
"nyc": "^11.4.1",
"rimraf": "^2.6.2"
},
"babel": {
"presets": [
[
"env",
{
"targets": {
"node": 4
}
}
]
]
}
}

@@ -7,4 +7,4 @@ # bookshelf-deep-changed-plugin

[![Dependencies][dependencies-image]][dependencies-url]
[![devDependencies][devdependencies-image]][devdependencies-url]
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
[![devDependencies][devdependencies-image]][devdependencies-url]
[![JavaScript Style Guide][standard-image]][standard-url]

@@ -69,1 +69,5 @@ Allows bookshelf models to check whether a value you save is different than the existing value in the database.

[devdependencies-url]: https://david-dm.org/OronNadiv/bookshelf-deep-changed-plugin?type=dev
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[standard-url]: http://standardjs.com