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

js-data

Package Overview
Dependencies
Maintainers
2
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-data - npm Package Compare versions

Comparing version 3.0.8 to 3.0.9

5

CHANGELOG.md

@@ -1,6 +0,1 @@

##### 3.0.8 - 3 September 2019
###### Bug fixes
- Fix beforeCreate & beforeCreateMany lifecycle hook re-assignment of props
##### 3.0.7 - 3 September 2019

@@ -7,0 +2,0 @@

24

lib/mindex/index.js

@@ -21,3 +21,3 @@ // Copyright (c) 2015, InternalFX.

import utils from '../../src/utils'
import {binarySearch, insertAt, removeAt} from './_utils'
import { binarySearch, insertAt, removeAt } from './_utils'

@@ -47,8 +47,8 @@ export default function Index (fieldList, opts) {

let key = keyList.shift() || undefined
let pos = binarySearch(this.keys, key)
const key = keyList.shift() || undefined
const pos = binarySearch(this.keys, key)
if (keyList.length === 0) {
if (pos.found) {
let dataLocation = binarySearch(this.values[pos.index], value, this.hashCode)
const dataLocation = binarySearch(this.values[pos.index], value, this.hashCode)
if (!dataLocation.found) {

@@ -66,3 +66,3 @@ insertAt(this.values[pos.index], dataLocation.index, value)

insertAt(this.keys, pos.index, key)
let newIndex = new Index([], { hashCode: this.hashCode })
const newIndex = new Index([], { hashCode: this.hashCode })
newIndex.set(keyList, value)

@@ -79,4 +79,4 @@ insertAt(this.values, pos.index, newIndex)

let key = keyList.shift() || undefined
let pos = binarySearch(this.keys, key)
const key = keyList.shift() || undefined
const pos = binarySearch(this.keys, key)

@@ -153,3 +153,3 @@ if (keyList.length === 0) {

let results = this._between(leftKeys, rightKeys, opts)
const results = this._between(leftKeys, rightKeys, opts)

@@ -166,4 +166,4 @@ if (opts.limit) {

let leftKey = leftKeys.shift()
let rightKey = rightKeys.shift()
const leftKey = leftKeys.shift()
const rightKey = rightKeys.shift()

@@ -209,3 +209,3 @@ let pos

for (let i = pos.index; i < this.keys.length; i += 1) {
let currKey = this.keys[i]
const currKey = this.keys[i]
if (currKey > rightKey) { break }

@@ -257,3 +257,3 @@

insertRecord (data) {
let keyList = this.fieldList.map(function (field) {
const keyList = this.fieldList.map(function (field) {
if (utils.isFunction(field)) {

@@ -260,0 +260,0 @@ return field(data) || undefined

{
"name": "js-data",
"description": "Robust, framework-agnostic in-memory data store.",
"version": "3.0.8",
"version": "3.0.9",
"homepage": "http://www.js-data.io",

@@ -51,13 +51,12 @@ "repository": {

"bundle": "npm run bundle:es5 && npm run bundle:next && repo-tools write-version dist/js-data.js dist/js-data.es2015.js",
"cover": "nyc --require babel-core/register --require babel-polyfill --cache mocha --recursive -t 20000 -R dot && nyc report --reporter=html",
"cover": "nyc --require @babel/register --require @babel/polyfill --cache mocha --recursive -R dot && nyc report --reporter=html",
"doc": "jsdoc -c conf.json src && node scripts/cleanup.js",
"gzip": "echo gzipped size: $(cat dist/js-data.min.js | gzip -f9 | wc -c)kb",
"karma": "karma start",
"lint": "eslint --fix src/**/*.js && standard 'src/**/*.js' 'test/**/*.js' 'scripts/*.js' 'lib/**/*.js' '*.config.js'",
"lint": "eslint --fix src/**/*.js && standard --fix 'src/**/*.js' 'test/**/*.js' 'scripts/*.js' 'lib/**/*.js' '*.config.js'",
"min": "uglifyjs -o dist/js-data.min.js --source-map url=js-data.min.map -v -m -c --keep-fnames --screw-ie8 -- dist/js-data.js",
"mocha": "mocha --recursive -t 20000 -R dot -r babel-core/register -r babel-polyfill",
"mocha": "mocha -b --recursive -R dot -r @babel/register -r @babel/polyfill",
"precommit": "lint-staged && npm run lint",
"prepush": "npm test",
"release": "npm test && npm run doc && repo-tools updates && repo-tools changelog && repo-tools authors",
"test": "npm run build && npm run cover && npm run karma"
"test": "npm run build && npm run cover"
},

@@ -73,40 +72,42 @@ "lint-staged": {

"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
"babel-plugin-external-helpers": "6.22.0",
"babel-plugin-syntax-async-functions": "6.13.0",
"babel-plugin-transform-es2015-modules-umd": "6.24.1",
"babel-plugin-transform-regenerator": "6.26.0",
"babel-polyfill": "6.26.0",
"babel-preset-env": "^1.7.0",
"chai": "^4.1.2",
"eslint": "^5.4.0",
"eslint-config-standard": "^12.0.0-alpha.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.0",
"eslint-plugin-standard": "^3.1.0",
"husky": "^0.14.3",
"ink-docstrap": "git+https://github.com/js-data/docstrap.git#cfbe45fa313e1628c493076d5e15d2b855dfbf2c",
"js-data-repo-tools": "1.0.0",
"jsdoc": "^3.5.5",
"karma": "3.0.0",
"karma-babel-preprocessor": "7.0.0",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-mocha": "1.3.0",
"karma-phantomjs-launcher": "1.0.4",
"karma-sauce-launcher": "1.2.0",
"karma-sinon": "1.0.5",
"lint-staged": "^7.2.2",
"mocha": "5.2.0",
"nyc": "12.0.2",
"phantomjs-prebuilt": "2.1.16",
"prettier-standard": "^8.0.1",
"rollup": "0.64.1",
"rollup-plugin-babel": "3.0.7",
"sinon": "6.1.5",
"standard": "11.0.1",
"uglify-js": "3.4.7"
"@babel/cli": "^7.8.3",
"@babel/core": "^7.8.3",
"@babel/node": "^7.8.3",
"@babel/plugin-external-helpers": "^7.8.3",
"@babel/plugin-transform-modules-umd": "^7.8.3",
"@babel/plugin-transform-regenerator": "^7.8.3",
"@babel/polyfill": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@js-data/repo-tools": "^1.0.1",
"babel-eslint": "^10.0.3",
"chai": "^4.2.0",
"docdash": "^1.1.1",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.2.1",
"jsdoc": "^3.6.3",
"karma": "^4.4.1",
"karma-babel-preprocessor": "^8.0.1",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sauce-launcher": "^2.0.2",
"karma-sinon": "^1.0.5",
"lint-staged": "^10.0.2",
"lodash": "^4.17.15",
"mocha": "^7.0.0",
"nyc": "15.0.0",
"phantomjs-prebuilt": "^2.1.16",
"prettier-standard": "^16.1.0",
"rollup": "^1.29.0",
"rollup-plugin-babel": "^4.3.3",
"sinon": "^8.1.0",
"standard": "14.3.1",
"uglify-js": "^3.7.6"
}
}

@@ -255,3 +255,3 @@ import utils from './utils'

records = records.map(record => {
let id = this.recordId(record)
const id = this.recordId(record)
// Grab existing record if there is one

@@ -258,0 +258,0 @@ const existing = id === undefined ? id : this.get(id)

@@ -49,3 +49,3 @@ import utils from './utils'

*/
this.debug = opts.hasOwnProperty('debug') ? !!opts.debug : false
this.debug = Object.hasOwnProperty.call(opts, 'debug') ? !!opts.debug : false

@@ -52,0 +52,0 @@ /**

@@ -221,3 +221,3 @@ import utils, { safeSetLink, safeSetProp } from './utils'

get () {
let current = getter.call(this)
const current = getter.call(this)
if (!current) {

@@ -407,3 +407,3 @@ this._set(path, [])

if (def.get) {
let origGet = descriptor.get
const origGet = descriptor.get
descriptor.get = function () {

@@ -414,3 +414,3 @@ return def.get(def, this, (...args) => origGet.apply(this, args))

if (def.set) {
let origSet = descriptor.set
const origSet = descriptor.set
descriptor.set = function (related) {

@@ -417,0 +417,0 @@ return def.set(def, this, related, (value) => origSet.call(this, value === undefined ? related : value))

@@ -92,3 +92,3 @@ /**

*/
import {Container} from './Container'
import { Container } from './Container'

@@ -95,0 +95,0 @@ /**

@@ -545,3 +545,3 @@ import utils from './utils'

if (orderBy) {
let index = 0
const index = 0
orderBy.forEach(function (def, i) {

@@ -1121,18 +1121,18 @@ if (utils.isString(def)) {

},
'isectEmpty': function (value, predicate) {
isectEmpty: function (value, predicate) {
return !utils.intersection((value || []), (predicate || [])).length
},
'isectNotEmpty': function (value, predicate) {
isectNotEmpty: function (value, predicate) {
return utils.intersection((value || []), (predicate || [])).length
},
'in': function (value, predicate) {
in: function (value, predicate) {
return predicate.indexOf(value) !== -1
},
'notIn': function (value, predicate) {
notIn: function (value, predicate) {
return predicate.indexOf(value) === -1
},
'contains': function (value, predicate) {
contains: function (value, predicate) {
return (value || []).indexOf(predicate) !== -1
},
'notContains': function (value, predicate) {
notContains: function (value, predicate) {
return (value || []).indexOf(predicate) === -1

@@ -1139,0 +1139,0 @@ }

@@ -498,3 +498,3 @@ import utils, { safeSetLink } from './utils'

mapper.dbg(op, this, relations, opts)
let tasks = []
const tasks = []
let task

@@ -520,3 +520,3 @@ utils.forEachRelation(mapper, opts, (def, optsCopy) => {

[relatedMapper.idAttribute]: {
'in': utils.get(this, def.localKeys)
in: utils.get(this, def.localKeys)
}

@@ -529,3 +529,3 @@ }

[def.foreignKeys]: {
'contains': utils.get(this, mapper.idAttribute)
contains: utils.get(this, mapper.idAttribute)
}

@@ -617,3 +617,3 @@ }

utils.forOwn(this, (value, key) => {
if (key !== this._mapper().idAttribute && !previous.hasOwnProperty(key) && this.hasOwnProperty(key) && opts.preserve.indexOf(key) === -1) {
if (key !== this._mapper().idAttribute && !Object.hasOwnProperty.call(previous, key) && Object.hasOwnProperty.call(this, key) && opts.preserve.indexOf(key) === -1) {
delete this[key]

@@ -620,0 +620,0 @@ }

@@ -66,3 +66,3 @@ import utils from '../utils'

[this.relatedCollection.mapper.idAttribute]: {
'in': ids
in: ids
}

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

[this.foreignKeys]: {
'contains': id
contains: id
}

@@ -81,0 +81,0 @@ }

@@ -6,8 +6,6 @@ import { Relation } from './Relation'

[BelongsToRelation, HasManyRelation, HasOneRelation].forEach(function (RelationType) {
Relation[RelationType.TYPE_NAME] = function (related, options) {
return new RelationType(related, options)
}
[BelongsToRelation, HasManyRelation, HasOneRelation].forEach(RelationType => {
Relation[RelationType.TYPE_NAME] = (related, options) => new RelationType(related, options)
})
export { belongsToType, hasManyType, hasOneType, Relation } from './Relation'

@@ -21,3 +21,3 @@ import utils from './utils'

integer: utils.isInteger,
'null': utils.isNull,
null: utils.isNull,
number: utils.isNumber,

@@ -183,3 +183,3 @@ object: utils.isObject,

enum (value, schema, opts) {
const possibleValues = schema['enum']
const possibleValues = schema.enum
if (utils.findIndex(possibleValues, (item) => utils.deepEqual(item, value)) === -1) {

@@ -557,3 +557,3 @@ return makeError(value, `one of (${possibleValues.join(', ')})`, opts)

const required = schema.required
let errors = []
const errors = []
if (!opts.existingOnly) {

@@ -744,3 +744,3 @@ required.forEach(function (prop) {

let shouldPop
let prevProp = opts.prop
const prevProp = opts.prop
if (schema === undefined) {

@@ -762,9 +762,9 @@ return

// Validate against parent schema
if (schema['extends']) {
if (schema.extends) {
// opts.path = path
// opts.prop = prop
if (utils.isFunction(schema['extends'].validate)) {
errors = errors.concat(schema['extends'].validate(value, opts) || [])
if (utils.isFunction(schema.extends.validate)) {
errors = errors.concat(schema.extends.validate(value, opts) || [])
} else {
errors = errors.concat(validate(value, schema['extends'], opts) || [])
errors = errors.concat(validate(value, schema.extends, opts) || [])
}

@@ -1023,7 +1023,7 @@ }

utils.forOwn(properties, function (schema, prop) {
if (schema.hasOwnProperty('default') && utils.get(target, prop) === undefined) {
if (Object.hasOwnProperty.call(schema, 'default') && utils.get(target, prop) === undefined) {
if (hasSet) {
target.set(prop, utils.plainCopy(schema['default']), { silent: true })
target.set(prop, utils.plainCopy(schema.default), { silent: true })
} else {
utils.set(target, prop, utils.plainCopy(schema['default']))
utils.set(target, prop, utils.plainCopy(schema.default))
}

@@ -1203,3 +1203,3 @@ }

if (this.type === 'object') {
let copy = {}
const copy = {}
const properties = this.properties

@@ -1206,0 +1206,0 @@ if (properties) {

@@ -146,3 +146,3 @@ /**

}
let optsCopy = {}
const optsCopy = {}
utils.fillIn(optsCopy, def.getRelation())

@@ -337,3 +337,3 @@ utils.fillIn(optsCopy, opts)

if (utils.isObject(from)) {
let index = stackFrom.indexOf(from)
const index = stackFrom.indexOf(from)
if (index !== -1) {

@@ -375,3 +375,3 @@ return stackTo[index]

for (var key in from) {
if (from.hasOwnProperty(key)) {
if (Object.hasOwnProperty.call(from, key)) {
if (utils.isBlacklisted(key, blacklist)) {

@@ -424,3 +424,3 @@ continue

utils.deepFillIn(existing, value)
} else if (!dest.hasOwnProperty(key) || dest[key] === undefined) {
} else if (!Object.hasOwnProperty.call(dest, key) || dest[key] === undefined) {
dest[key] = value

@@ -490,3 +490,3 @@ }

let equalsFn = opts.equalsFn
let blacklist = opts.ignore
const blacklist = opts.ignore
const diff = {

@@ -695,3 +695,3 @@ added: {},

if (props.hasOwnProperty('constructor')) {
if (Object.hasOwnProperty.call(props, 'constructor')) {
subClass = props.constructor

@@ -727,3 +727,3 @@ delete props.constructor

}
if (!subClass.hasOwnProperty('__super__')) {
if (!Object.hasOwnProperty.call(subClass, '__super__')) {
Object.defineProperty(subClass, '__super__', {

@@ -761,3 +761,3 @@ configurable: true,

utils.forOwn(src, function (value, key) {
if (!dest.hasOwnProperty(key) || dest[key] === undefined) {
if (!Object.hasOwnProperty.call(dest, key) || dest[key] === undefined) {
dest[key] = value

@@ -938,3 +938,3 @@ }

const ctor = isCtor ? instance : instance.constructor
if (ctor.hasOwnProperty('__super__')) {
if (Object.hasOwnProperty.call(ctor, '__super__')) {
return ctor.__super__

@@ -941,0 +941,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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