UNPKG

necto

Version:

Necto compliments Redux by providing a composable, declarative api to create flows through redux (Action -> Reducer or Action -> Saga). The intent of Necto is to reduce boilerplate, simplify and standardize action creators, and group action logic so that

21 lines (17 loc) 659 B
// Polyfill for Object.entries // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries#Polyfill const entries = function(obj) { var ownProps = Object.keys(obj), i = ownProps.length, resArray = new Array(i); while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]]; return resArray; }; const isValidTypeofObject = obj => [Object, Array].includes((obj || {}).constructor); const isEmpty = obj => { // Objects are considered empty if they have no own enumerable string keyed properties. if (!isValidTypeofObject(obj)) return true; return !entries(obj || {}).length; }; export default isEmpty;