Socket
Socket
Sign inDemoInstall

redux-object

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-object - npm Package Compare versions

Comparing version 0.5.8 to 0.5.9

.nyc_output/60bfa8be-4a45-47f0-b7b4-1e2e12611414.json

3

CHANGELOG.md

@@ -0,1 +1,4 @@

### Version 0.5.9 (17th January 2019)
Deps update; istanbul -> nyc for code coverage reporting
### Version 0.5.8 (16th January 2019)

@@ -2,0 +5,0 @@ Introduced `resolved` property (https://github.com/yury-dymov/redux-object/pull/38)

248

dist/bundle.js

@@ -1,247 +0,1 @@

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;
}
/***/ })
/******/ ]);
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}]);
{
"name": "redux-object",
"version": "0.5.8",
"version": "0.5.9",
"description": "Builds complex JS object from normalized redux store. Best works with json-api-normalizer",

@@ -9,3 +9,3 @@ "main": "dist/bundle.min.js",

"clean": "rimraf dist coverage lib",
"coverage": "cross-env NODE_ENV=production webpack && istanbul cover _mocha -- --compilers js:@babel/register && NODE_ENV=production webpack -p",
"coverage": "cross-env NODE_ENV=production webpack && nyc _mocha --compilers js:@babel/register && NODE_ENV=production webpack -p",
"lint": "eslint src --ext .js",

@@ -37,3 +37,3 @@ "test": "mocha --compilers js:@babel/register"

"cross-env": "^5.2.0",
"eslint": "^5.9.0",
"eslint": "^5.12.0",
"eslint-config-airbnb": "^17.1.0",

@@ -45,5 +45,5 @@ "eslint-loader": "^2.1.1",

"immutable": "^4.0.0-rc.12",
"istanbul": "^1.1.0-alpha.1",
"lodash": "^4.17.5",
"mocha": "^5.2.0",
"nyc": "^13.1.0",
"rimraf": "^2.6.2",

@@ -50,0 +50,0 @@ "webpack": "^3.12.0",

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