redux-object
Advanced tools
Comparing version 0.5.9 to 0.5.10
@@ -0,1 +1,4 @@ | ||
### Version 0.5.10 (17th June 2019) | ||
Updated vulnerable deps | ||
### Version 0.5.9 (17th January 2019) | ||
@@ -2,0 +5,0 @@ Deps update; istanbul -> nyc for code coverage reporting |
@@ -1,1 +0,247 @@ | ||
module.exports=function(e){function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}var t={};return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=0)}([function(e,r,t){e.exports=t(1)},function(e,r,t){"use strict";function n(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(e.hasOwnProperty("__ownerID")||e._map&&e._map.hasOwnProperty("__ownerID")))}function i(e,r){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(r)||(r=[r]),n(e)){var i=e.getIn(r.map(function(e){return"".concat(e)}));return t&&i?i.toJS():i}return r.reduce(function(e,r){return e[r]},e)}function o(e){return n(e)?e.keySeq().toArray():Object.keys(e)}function u(e,r){return r?"".concat(e).concat(r):null}function a(e,r,t,n,i){var o=n.ignoreLinks,u=r.relationships[t];if(void 0!==u.data)return Array.isArray(u.data)?u.data.map(function(r){return c(e,r.type,r.id,n,i)||r}):null===u.data?null:c(e,u.data.type,u.data.id,n,i)||u.data;if(!o&&u.links)throw new Error("Remote lazy loading is not supported (see: https://github.com/yury-dymov/json-api-normalizer/issues/2). To disable this error, include option 'ignoreLinks: true' in the build function like so: build(reducer, type, id, { ignoreLinks: true })")}function c(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},s={eager:!1,ignoreLinks:!1,includeType:!1},d=Object.assign({},s,n),f=d.eager,p=d.includeType;if(!i(e,r))return null;if(null===t||Array.isArray(t)){return(t||o(i(e,r))).map(function(t){return c(e,r,t,d,l)})}var y=t.toString(),v=u(r,y),b=l[v];if(b)return b;var g={},h=i(e,[r,y],!0);return h?(h.id&&(g.id=h.id),h.attributes&&(Object.keys(h.attributes).forEach(function(e){g[e]=h.attributes[e]}),Object.defineProperty(g,"resolved",{value:!0})),h.meta&&(g.meta=h.meta),h.links&&(g.links=h.links),p&&!g.type&&(g.type=r),l[v]=g,h.relationships&&Object.keys(h.relationships).forEach(function(r){f?g[r]=a(e,h,r,d,l):Object.defineProperty(g,r,{enumerable:!0,get:function(){var t="__".concat(r);if(g[t])return g[t];var n=a(e,h,r,d,l);return Object.defineProperty(g,t,{enumerable:!1,value:n}),g[t]}})}),void 0===g.id&&(g.id=y),g):null}Object.defineProperty(r,"__esModule",{value:!0}),r.default=c}]); | ||
module.exports = | ||
/******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(1); | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony export (immutable) */ __webpack_exports__["default"] = build; | ||
/* eslint no-use-before-define: [1, 'nofunc'] */ | ||
// Immutable helpers | ||
function isImmutable(object) { | ||
return !!(object && typeof object.hasOwnProperty === 'function' && (object.hasOwnProperty('__ownerID') // eslint-disable-line | ||
|| object._map && object._map.hasOwnProperty('__ownerID')) // eslint-disable-line | ||
); | ||
} | ||
function getProperty(object, property) { | ||
var toJS = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
if (!Array.isArray(property)) { | ||
property = [property]; | ||
} | ||
if (isImmutable(object)) { | ||
var res = object.getIn(property.map(function (p) { | ||
return "".concat(p); | ||
})); // Immutable maps cast keys to strings | ||
return toJS && res ? res.toJS() : res; | ||
} | ||
return property.reduce(function (previous, current) { | ||
return previous[current]; | ||
}, object); | ||
} | ||
function getKeys(object) { | ||
return isImmutable(object) ? object.keySeq().toArray() : Object.keys(object); | ||
} // build helpers | ||
function uniqueId(objectName, id) { | ||
if (!id) { | ||
return null; | ||
} | ||
return "".concat(objectName).concat(id); | ||
} | ||
function buildRelationship(reducer, target, relationship, options, cache) { | ||
var ignoreLinks = options.ignoreLinks; | ||
var rel = target.relationships[relationship]; | ||
if (typeof rel.data !== 'undefined') { | ||
if (Array.isArray(rel.data)) { | ||
return rel.data.map(function (child) { | ||
return build(reducer, child.type, child.id, options, cache) || child; | ||
}); | ||
} | ||
if (rel.data === null) { | ||
return null; | ||
} | ||
return build(reducer, rel.data.type, rel.data.id, options, cache) || rel.data; | ||
} | ||
if (!ignoreLinks && rel.links) { | ||
throw new Error('Remote lazy loading is not supported (see: https://github.com/yury-dymov/json-api-normalizer/issues/2). To disable this error, include option \'ignoreLinks: true\' in the build function like so: build(reducer, type, id, { ignoreLinks: true })'); | ||
} | ||
return undefined; | ||
} | ||
function build(reducer, objectName) { | ||
var id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
var providedOpts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var cache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; | ||
var defOpts = { | ||
eager: false, | ||
ignoreLinks: false, | ||
includeType: false | ||
}; | ||
var options = Object.assign({}, defOpts, providedOpts); | ||
var eager = options.eager, | ||
includeType = options.includeType; | ||
if (!getProperty(reducer, objectName)) { | ||
return null; | ||
} | ||
if (id === null || Array.isArray(id)) { | ||
var idList = id || getKeys(getProperty(reducer, objectName)); | ||
return idList.map(function (e) { | ||
return build(reducer, objectName, e, options, cache); | ||
}); | ||
} | ||
var ids = id.toString(); | ||
var uuid = uniqueId(objectName, ids); | ||
var cachedObject = cache[uuid]; | ||
if (cachedObject) { | ||
return cachedObject; | ||
} | ||
var ret = {}; | ||
var target = getProperty(reducer, [objectName, ids], true); | ||
if (!target) { | ||
return null; | ||
} | ||
if (target.id) { | ||
ret.id = target.id; | ||
} | ||
if (target.attributes) { | ||
Object.keys(target.attributes).forEach(function (key) { | ||
ret[key] = target.attributes[key]; | ||
}); | ||
Object.defineProperty(ret, 'resolved', { | ||
value: true | ||
}); | ||
} | ||
if (target.meta) { | ||
ret.meta = target.meta; | ||
} | ||
if (target.links) { | ||
ret.links = target.links; | ||
} | ||
if (includeType && !ret.type) { | ||
ret.type = objectName; | ||
} | ||
cache[uuid] = ret; | ||
if (target.relationships) { | ||
Object.keys(target.relationships).forEach(function (relationship) { | ||
if (eager) { | ||
ret[relationship] = buildRelationship(reducer, target, relationship, options, cache); | ||
} else { | ||
Object.defineProperty(ret, relationship, { | ||
enumerable: true, | ||
get: function get() { | ||
var field = "__".concat(relationship); | ||
if (ret[field]) { | ||
return ret[field]; | ||
} | ||
var value = buildRelationship(reducer, target, relationship, options, cache); | ||
Object.defineProperty(ret, field, { | ||
enumerable: false, | ||
value: value | ||
}); | ||
return ret[field]; | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
if (typeof ret.id === 'undefined') { | ||
ret.id = ids; | ||
} | ||
return ret; | ||
} | ||
/***/ }) | ||
/******/ ]); |
{ | ||
"name": "redux-object", | ||
"version": "0.5.9", | ||
"version": "0.5.10", | ||
"description": "Builds complex JS object from normalized redux store. Best works with json-api-normalizer", | ||
@@ -36,3 +36,3 @@ "main": "dist/bundle.min.js", | ||
"cross-env": "^5.2.0", | ||
"eslint": "^5.12.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-airbnb": "^17.1.0", | ||
@@ -39,0 +39,0 @@ "eslint-loader": "^2.1.1", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41322
208
1