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

linen

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linen - npm Package Compare versions

Comparing version 0.1.29 to 0.1.33

2

lib/fields.js

@@ -103,3 +103,3 @@ // Generated by CoffeeScript 1.6.2

for (fieldName in this._fields) {
if (v = dref.get(d, fieldName)) {
if ((v = dref.get(d, fieldName)) != null) {
dref.set(d, fieldName, this._fields[fieldName].map(model, v));

@@ -106,0 +106,0 @@ }

// Generated by CoffeeScript 1.6.2
(function() {
var Model, bindable, dref, payload, _,
var Model, bindable, dref, memoize, payload, type, _,
__hasProp = {}.hasOwnProperty,

@@ -16,2 +16,6 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },

type = require("type-component");
memoize = require("./memoize");
Model = (function(_super) {

@@ -31,2 +35,5 @@ __extends(Model, _super);

function Model(schema) {
var oldFetch,
_this = this;
this.schema = schema;

@@ -36,2 +43,8 @@ Model.__super__.constructor.call(this, {});

this._fetchedWatched = {};
oldFetch = this._fetch;
this._throttledFetch = memoize((function(next) {
return _this.fetch(next);
}), {
maxAge: 1000 * 5
});
}

@@ -131,7 +144,15 @@

Model.prototype.fetch = function(next) {
Model.prototype.fetch = function(property, next) {
if (type(property) === "function") {
next = property;
property = void 0;
}
if (this.isNew()) {
return next(new Error("cannot '" + this.schema.name + "' fetch on a new model"));
}
return this._fetch(payload.model(this).method("GET"), next);
if (!property) {
return this._fetch(payload.model(this).method("GET"), next);
} else {
return this._getProperty(property, next);
}
};

@@ -202,8 +223,26 @@

Model.prototype._watching = function(property) {
var fetchable, i, isVirtual, key, props, v, _i, _len;
if (this._ignoreFetch) {
return;
}
return this._getProperty(property);
};
/*
*/
Model.prototype._getProperty = function(property, next) {
var fetchable, i, isVirtual, key, onFetch, props, _i, _len,
_this = this;
if (next == null) {
next = function() {};
}
props = property.split(".");
onFetch = function(err) {
if (err != null) {
return next(err);
}
return next(void 0, _this.get(property));
};
for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {

@@ -216,19 +255,26 @@ key = props[i];

if (!fetchable) {
return;
return onFetch();
}
property = (isVirtual = fetchable.isFetchable()) ? fetchable.property : "__default";
if (this._fetchedWatched[property]) {
return;
key = (isVirtual = fetchable.isFetchable()) ? fetchable.property : "__default";
if (this._fetchedWatched[key]) {
return this._fetchedWatched[key](onFetch);
}
this._fetchedWatched[property] = true;
if (isVirtual) {
v = this.get(fetchable.property);
if (v && (v.__isModel || v.__isCollection)) {
return v.fetch(function() {});
this._fetchedWatched[key] = memoize(function(next) {
var v;
if (isVirtual) {
v = _this.get(fetchable.property);
if (v && (v.__isModel || v.__isCollection)) {
return v.fetch(next);
} else {
return fetchable.fetch(payload.model(_this).method("GET").data, next);
}
} else {
return fetchable.fetch(payload.model(this).method("GET").data, function() {});
if ((_this.get(property) != null) && !(fetchable != null ? fetchable.isVirtual() : void 0)) {
return next();
}
return _this._throttledFetch(next);
}
} else {
return this._throttledFetch(function() {});
}
});
return this._fetchedWatched[key].call(this, onFetch);
};

@@ -255,10 +301,2 @@

Model.prototype._throttledFetch = _.throttle((function() {
return this.fetch();
}), 1000 * 5);
/*
*/
Model.prototype.clone = function() {

@@ -265,0 +303,0 @@ return this.schema.model(this);

{
"name": "linen",
"version": "0.1.29",
"version": "0.1.33",
"description": "```javascript",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

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