Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bem-promised-models

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bem-promised-models - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

78

blocks/promised-models/__model/promised-models__model.js

@@ -256,3 +256,3 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

this.storage = new Storage();
this.attributes = Object.keys(this.attributes || {}).reduce(function (attributes, name) {
this.attributes = Object.keys(this.__self.attributes || {}).reduce(function (attributes, name) {
var Attribute = model.attributes[name];

@@ -286,3 +286,2 @@ attributes[name] = new (Attribute.inherit({

/**

@@ -294,19 +293,20 @@ * save model changes

var model = this;
if (model.isNew()) {
return model.ready().then(function () {
return model.storage.insert(model);
}).then(function (id) {
model.id = id;
model.commit();
model.calculate().done();
return model.ready();
});
} else {
return model.ready().then(function () {
return model.storage.update(model);
}).then(function () {
model.commit();
});
}
return this._rejectDestructed().then(function () {
if (model.isNew()) {
return model.ready().then(function () {
return model.storage.insert(model);
}).then(function (id) {
model.id = id;
model.commit();
model.calculate().done();
return model.ready();
});
} else {
return model.ready().then(function () {
return model.storage.update(model);
}).then(function () {
model.commit();
});
}
});
},

@@ -439,3 +439,5 @@

Object.keys(data).forEach(function (name) {
model.set(name, data[name]);
if (data[name] !== undefined) {
model.set(name, data[name]);
}
});

@@ -482,5 +484,7 @@ } else if (this.attributes[name]) {

* @param {*} [ctx]
* @return {Model}
*/
un: function (attribute, event, cb, ctx) {
this._callEventEmitter('removeListener', attribute, event, cb, ctx);
return this;
},

@@ -494,5 +498,7 @@

* @param {*} [ctx]
* @return {Model}
*/
on: function (attribute, event, cb, ctx) {
this._callEventEmitter('on', attribute, event, cb, ctx);
return this;
},

@@ -539,2 +545,4 @@

this._readyPromise = this._calculate();
} else {
this._requireMoreCalculations = true;
}

@@ -558,2 +566,8 @@ if (this.throwCalculationErrors) {

/**
* marker that requires one more calculation cycle
* @type {Boolean}
*/
_requireMoreCalculations: false,
/**
* @param {Number} [n = 0] itteration

@@ -593,3 +607,4 @@ * @return {Promise}

model.set(calculateData);
if (model.isChanged(model.CALCULATIONS_BRANCH)) {
if (model.isChanged(model.CALCULATIONS_BRANCH) || model._requireMoreCalculations) {
model._requireMoreCalculations = false;
return model._calculate(++n);

@@ -677,2 +692,13 @@ } else {

/**
* @return {Promise}
*/
_rejectDestructed: function () {
if (this.isDestructed()) {
return Vow.reject(new Error ('Model is destructed'));
} else {
return Vow.fulfill();
}
},
_throwMissedAttribute: function (attributeName) {

@@ -687,2 +713,12 @@ if (!this.attributes[attributeName]) {

/**
* @override
*/
inherit: function (props, staticProps) {
staticProps = staticProps || {};
staticProps.attributes = staticProps.attributes || props.attributes;
staticProps.storage = staticProps.storage || props.storage;
return this.__base(props, staticProps);
},
/**
* @class

@@ -689,0 +725,0 @@ * @abstract

{
"description": "BEM wrapper for promised-models",
"name": "bem-promised-models",
"version": "0.0.13",
"version": "0.0.14",
"repository": "git@github.com:delfrrr/bem-promised-models.git",

@@ -31,3 +31,3 @@ "keywords": [

"dependencies": {
"promised-models": "0.0.11"
"promised-models": "0.0.12"
},

@@ -34,0 +34,0 @@ "devDependencies": {

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