backbone-jsonapi
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -1,2 +0,2 @@ | ||
/*! backbone-jsonapi - v 0.1.5 - Copyright guillaumervls 2013-11-26 */ | ||
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var c=a("./toolbox");b.exports=function(a,d){if(!a||!d)throw new Error("Backbone and/or Lodash (or Underscore) are not loaded...");return c=c(d),a.Collection.prototype.parse=function(a){if(void 0!==a){var b=c.parse(a),e=c.getMainCollection(a);return d.each(b[e],function(a){a._alreadyBBJSONAPIParsed=!0})}},a.Model.prototype.parse=function(a){if(void 0!==a){if(a._alreadyBBJSONAPIParsed)return delete a._alreadyBBJSONAPIParsed,a;var b=c.parse(a),d=c.getMainCollection(a);return b[d][0]}},b.exports},b.exports.VERSION="0.1.5"},{"./toolbox":2}],2:[function(a,b){var c;b.exports=function(a){return c=a,c.forOwn=c.forOwn||function(a,b){var d;try{d=c.keys(a)}catch(e){return}c.each(d,function(c){b(a[c],c)})},b.exports};var d=b.exports.findById=function(a,b){return c.find(a,function(a){return a.id===b})},e=b.exports.applyTemplateUrl=function(a,b,c){var d=new RegExp("{"+a+"\\.(.+?)}","g"),e=d.exec(b);if(null!==e){if(void 0===c[e[1]]&&void 0===c.links[e[1]])throw new Error("Template required a property not present in data object");b=b.substr(0,e.index)+(c.links[e[1]]||c[e[1]])+b.substr(d.lastIndex)}return b},f=b.exports.processLink=function(a,b,f){var g=f.split("."),h=g[0],i=g[1];return c.each(a[h],function(c){if(c.links=c.links||{},void 0!==c.links[i]){var f=d(a[b.type],c.links[i]);void 0!==f&&(c[i]=f)}c.links[i]=e(h,b.href,c)}),a};b.exports.parse=function(a){return c.forOwn(a.links,function(b,c){f(a,b,c)}),a},b.exports.getMainCollection=function(a){var b=c.without(c.keys(a),"links","meta"),d=c.pluck(c.values(a.links),"type");return c.difference(b,d)[0]}},{}],3:[function(a){var b=a("./backbone-jsonapi");"function"==typeof define&&define.amd?define(["Backbone","_"],function(a,c){return window.backboneJsonApi=b(a,c),window.backboneJsonApi}):window.backboneJsonApi=b(window.Backbone,window._)},{"./backbone-jsonapi":1}]},{},[3]); | ||
/*! backbone-jsonapi - v 0.1.6 - Copyright guillaumervls 2013-11-27 */ | ||
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var c=a("./toolbox");b.exports=function(a,d){if(!a||!d)throw new Error("Backbone and/or Lodash (or Underscore) are not loaded...");return c=c(d),a.Collection.prototype.parse=function(a){if(void 0!==a){var b=c.parse(a),e=c.getMainCollection(a);return d.each(b[e],function(a){a._alreadyBBJSONAPIParsed=!0})}},a.Model.prototype.parse=function(a){if(void 0!==a){if(a._alreadyBBJSONAPIParsed)return delete a._alreadyBBJSONAPIParsed,a;var b=c.parse(a),d=c.getMainCollection(a);return b[d][0]}},b.exports},b.exports.VERSION="0.1.6"},{"./toolbox":2}],2:[function(a,b){var c;b.exports=function(a){return c=a,c.forOwn=c.forOwn||function(a,b){var d;try{d=c.keys(a)}catch(e){return}c.each(d,function(c){b(a[c],c)})},b.exports};var d=b.exports.findById=function(a,b){return c.find(a,function(a){return a.id===b})},e=b.exports.applyTemplateUrl=function(a,b,c){var d=new RegExp("{"+a+"\\.(.+?)}","g"),e=d.exec(b);if(null!==e){if(void 0===c[e[1]]&&void 0===c.links[e[1]])throw new Error("Template required a property not present in data object");b=b.substr(0,e.index)+(c.links[e[1]]||c[e[1]])+b.substr(d.lastIndex)}return b},f=b.exports.processLink=function(a,b,f){var g=f.split("."),h=g[0],i=g[1];return c.each(a[h],function(c){if(c.links=c.links||{},void 0!==c.links[i]){var f=d(a[b.type],c.links[i]);void 0!==f&&(c[i]=f)}try{c.links[i]=e(h,b.href,c)}catch(g){}}),a};b.exports.parse=function(a){return c.forOwn(a.links,function(b,c){f(a,b,c)}),a},b.exports.getMainCollection=function(a){var b=c.without(c.keys(a),"links","meta"),d=c.pluck(c.values(a.links),"type");return c.difference(b,d)[0]}},{}],3:[function(a){var b=a("./backbone-jsonapi");"function"==typeof define&&define.amd?define(["Backbone","_"],function(a,c){return window.backboneJsonApi=b(a,c),window.backboneJsonApi}):window.backboneJsonApi=b(window.Backbone,window._)},{"./backbone-jsonapi":1}]},{},[3]); |
{ | ||
"name": "backbone-jsonapi", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Backbone Model & Collection .parse() functions for data from a JSON API", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -33,2 +33,2 @@ var toolbox = require('./toolbox'); | ||
module.exports.VERSION = '0.1.5'; | ||
module.exports.VERSION = '0.1.6'; |
@@ -51,3 +51,5 @@ var _; | ||
} | ||
item.links[attribute] = applyTemplateUrl(collection, linkObj.href, item); | ||
try { | ||
item.links[attribute] = applyTemplateUrl(collection, linkObj.href, item); | ||
} catch (e) {} | ||
}); | ||
@@ -54,0 +56,0 @@ return response; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22926
553