MCPcopy Create free account
hub / github.com/microsoft/SandDance / createIterable

Function createIterable

docs/tests/v2/es6/js/sanddance.js:61715–61738  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

61713 */
61714
61715function createIterable(data) {
61716 var iterable = EMPTY_ARRAY;
61717 var objectInfo = {
61718 index: -1,
61719 data: data,
61720 // visitor can optionally utilize this to avoid constructing a new array for every object
61721 target: []
61722 };
61723
61724 if (!data) {
61725 iterable = EMPTY_ARRAY;
61726 } else if (typeof data[Symbol.iterator] === 'function') {
61727 // data is already an iterable
61728 iterable = data;
61729 } else if (data.length > 0) {
61730 placeholderArray.length = data.length;
61731 iterable = placeholderArray;
61732 }
61733
61734 return {
61735 iterable: iterable,
61736 objectInfo: objectInfo
61737 };
61738}
61739},{}],"mZUr":[function(require,module,exports) {
61740"use strict";
61741

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected