MCPcopy Create free account
hub / github.com/Lucifier129/react-lite / createArrayFromMixed

Function createArrayFromMixed

examples/simple/react.js:17846–17854  ·  view source on GitHub ↗

* Ensure that the argument is an array by wrapping it in an array if it is not. * Creates a copy of the argument if it is already an array. * * This is mostly useful idiomatically: * * var createArrayFromMixed = require('createArrayFromMixed'); * * function takesOneOrMoreThings(things) {

(obj)

Source from the content-addressed store, hash-verified

17844 * @return {array}
17845 */
17846function createArrayFromMixed(obj) {
17847 if (!hasArrayNature(obj)) {
17848 return [obj];
17849 } else if (Array.isArray(obj)) {
17850 return obj.slice();
17851 } else {
17852 return toArray(obj);
17853 }
17854}
17855
17856module.exports = createArrayFromMixed;
17857},{"153":153}],134:[function(_dereq_,module,exports){

Callers 1

createNodesFromMarkupFunction · 0.85

Calls 2

hasArrayNatureFunction · 0.85
toArrayFunction · 0.70

Tested by

no test coverage detected