Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pawarvijay/react-chopper
Browse files Browse the repository at this point in the history
  • Loading branch information
vijay committed Feb 8, 2020
2 parents 1020e13 + f395e6c commit dd47fc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -4,7 +4,8 @@ react-chopper
<img src="https://raw.githubusercontent.com/pawarvijay/react-chopper/master/helicopter.svg?sanitize=true" width="300" height="200"/>
</h1>

<h3 align="center">Code without setState</h3>
<h3 align="center">Create Datamodels in react</h3>
<h4 align="center">Code without setState</h4>
<h4 align="center">No need to remember this.setState()</h4>
<h4 align="center">No need to manage state in redux(use only for global data like global user info , global ui loader)</h4>
<h4 align="center">No need to use other libraries for state management</h4>
Expand Down
13 changes: 1 addition & 12 deletions src/index.js
Expand Up @@ -34,23 +34,12 @@ export const ReactChopper = (target, componentReference) => {
*/
const isNotAnEmptyObject = (data) => isObject(data) && Object.keys(data).length > 0;

/**
* function `isArrayOfObject`.
*
* Returns true if `data` is an array of object/objects, false otherwise.
*/
const isArrayOfObject = (data) => {
let isArray = Array.isArray(data);
if (isArray && data.length > 0) return (data.filter(item => isObject(item)).length === data.length);
else return false;
}

/**
* function `isProxifiable`.
*
* Returns true if `data` can be isProxifiable, false otherwise.
*/
const isProxifiable = (data) => ((data instanceof Array && isArrayOfObject(data)) || data instanceof Object && isNotAnEmptyObject(data)) ? true : false;
const isProxifiable = (data) => ((data instanceof Array) || data instanceof Object && isNotAnEmptyObject(data)) ? true : false;

/**
* function `proxify`.
Expand Down

0 comments on commit dd47fc0

Please sign in to comment.