MCPcopy Create free account
hub / github.com/Lobos/react-ui / createArrayFromMixed

Function createArrayFromMixed

docs/lib/react.js:18434–18442  ·  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

18432 * @return {array}
18433 */
18434function createArrayFromMixed(obj) {
18435 if (!hasArrayNature(obj)) {
18436 return [obj];
18437 } else if (Array.isArray(obj)) {
18438 return obj.slice();
18439 } else {
18440 return toArray(obj);
18441 }
18442}
18443
18444module.exports = createArrayFromMixed;
18445},{"156":156}],147:[function(_dereq_,module,exports){

Callers 1

createNodesFromMarkupFunction · 0.85

Calls 2

hasArrayNatureFunction · 0.85
toArrayFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…