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.5 to 0.5.6

5

CHANGELOG.md

@@ -1,2 +0,5 @@

### Version 0.5.5 (2nd January 2017)
### Version 0.5.6 (29th March 2018)
Added support for immutable.js (https://github.com/yury-dymov/redux-object/pull/34)
### Version 0.5.5 (2nd January 2018)
Fixes bug, when object doesn't have any attributes (https://github.com/yury-dymov/redux-object/pull/32)

@@ -3,0 +6,0 @@

37

dist/bundle.js

@@ -66,2 +66,33 @@ module.exports =

// 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 '' + 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) {

@@ -107,3 +138,3 @@ if (!id) {

if (!reducer[objectName]) {
if (!getProperty(reducer, objectName)) {
return null;

@@ -113,3 +144,3 @@ }

if (id === null || Array.isArray(id)) {
var idList = id || Object.keys(reducer[objectName]);
var idList = id || getKeys(getProperty(reducer, objectName));

@@ -130,3 +161,3 @@ return idList.map(function (e) {

var ret = {};
var target = reducer[objectName][ids];
var target = getProperty(reducer, [objectName, ids], true);

@@ -133,0 +164,0 @@ if (!target) {

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

module.exports=function(e){function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){e.exports=t(1)},function(e,r){"use strict";function t(e,r){return r?""+e+r:null}function n(e,r,t,n,o){var a=n.ignoreLinks,u=r.relationships[t];if("undefined"!=typeof u.data)return Array.isArray(u.data)?u.data.map(function(r){return i(e,r.type,r.id,n,o)||r}):null===u.data?null:i(e,u.data.type,u.data.id,n,o)||u.data;if(!a&&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 i(e,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},d={eager:!1,ignoreLinks:!1,includeType:!1},s=o({},d,u),c=s.eager,f=s.includeType;if(!e[r])return null;if(null===a||Array.isArray(a)){var p=a||Object.keys(e[r]);return p.map(function(t){return i(e,r,t,s,l)})}var y=a.toString(),v=t(r,y),b=l[v];if(b)return b;var g={},h=e[r][y];return h?(h.id&&(g.id=h.id),h.attributes&&Object.keys(h.attributes).forEach(function(e){g[e]=h.attributes[e]}),h.meta&&(g.meta=h.meta),f&&!g.type&&(g.type=r),l[v]=g,h.relationships&&Object.keys(h.relationships).forEach(function(r){c?g[r]=n(e,h,r,s,l):Object.defineProperty(g,r,{enumerable:!0,get:function(){var t="__"+r;if(g[t])return g[t];var i=n(e,h,r,s,l);return Object.defineProperty(g,t,{enumerable:!1,value:i}),g[t]}})}),"undefined"==typeof g.id&&(g.id=y),g):null}Object.defineProperty(r,"__esModule",{value:!0});var o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e};r.default=i}]);
module.exports=function(e){function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){e.exports=t(1)},function(e,r){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(e.hasOwnProperty("__ownerID")||e._map&&e._map.hasOwnProperty("__ownerID")))}function n(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(r)||(r=[r]),t(e)){var i=e.getIn(r.map(function(e){return""+e}));return n&&i?i.toJS():i}return r.reduce(function(e,r){return e[r]},e)}function i(e){return t(e)?e.keySeq().toArray():Object.keys(e)}function o(e,r){return r?""+e+r:null}function a(e,r,t,n,i){var o=n.ignoreLinks,a=r.relationships[t];if("undefined"!=typeof a.data)return Array.isArray(a.data)?a.data.map(function(r){return u(e,r.type,r.id,n,i)||r}):null===a.data?null:u(e,a.data.type,a.data.id,n,i)||a.data;if(!o&&a.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 u(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},f={eager:!1,ignoreLinks:!1,includeType:!1},c=s({},f,l),p=c.eager,y=c.includeType;if(!n(e,r))return null;if(null===t||Array.isArray(t)){var v=t||i(n(e,r));return v.map(function(t){return u(e,r,t,c,d)})}var h=t.toString(),b=o(r,h),g=d[b];if(g)return g;var m={},O=n(e,[r,h],!0);return O?(O.id&&(m.id=O.id),O.attributes&&Object.keys(O.attributes).forEach(function(e){m[e]=O.attributes[e]}),O.meta&&(m.meta=O.meta),y&&!m.type&&(m.type=r),d[b]=m,O.relationships&&Object.keys(O.relationships).forEach(function(r){p?m[r]=a(e,O,r,c,d):Object.defineProperty(m,r,{enumerable:!0,get:function(){var t="__"+r;if(m[t])return m[t];var n=a(e,O,r,c,d);return Object.defineProperty(m,t,{enumerable:!1,value:n}),m[t]}})}),"undefined"==typeof m.id&&(m.id=h),m):null}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e};r.default=u}]);
{
"name": "redux-object",
"version": "0.5.5",
"version": "0.5.6",
"description": "Builds complex JS object from normalized redux store. Best works with json-api-normalizer",

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

"eslint-plugin-react": "^6.8.0",
"immutable": "^3.8.2",
"istanbul": "^1.1.0-alpha.1",

@@ -46,0 +47,0 @@ "lodash": "^4.17.2",

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