MCPcopy Index your code
hub / github.com/microsoft/SandDance / padArray

Function padArray

docs/tests/v2/es6/js/sanddance.js:40713–40765  ·  view source on GitHub ↗
(_ref2)

Source from the content-addressed store, hash-verified

40711
40712
40713function padArray(_ref2) {
40714 var source = _ref2.source,
40715 target = _ref2.target,
40716 size = _ref2.size,
40717 getData = _ref2.getData,
40718 sourceLayout = _ref2.sourceLayout,
40719 targetLayout = _ref2.targetLayout;
40720
40721 if (!Array.isArray(targetLayout)) {
40722 // Flat arrays
40723 padArrayChunk({
40724 source: source,
40725 target: target,
40726 getData: getData
40727 });
40728 return target;
40729 } // Arrays have internal structure
40730
40731
40732 var sourceIndex = 0;
40733 var targetIndex = 0;
40734
40735 var getChunkData = getData && function (i, chunk) {
40736 return getData(i + targetIndex, chunk);
40737 };
40738
40739 var n = Math.min(sourceLayout.length, targetLayout.length);
40740
40741 for (var i = 0; i < n; i++) {
40742 var sourceChunkLength = sourceLayout[i] * size;
40743 var targetChunkLength = targetLayout[i] * size;
40744 padArrayChunk({
40745 source: source.subarray(sourceIndex, sourceIndex + sourceChunkLength),
40746 target: target,
40747 start: targetIndex,
40748 end: targetIndex + targetChunkLength,
40749 getData: getChunkData
40750 });
40751 sourceIndex += sourceChunkLength;
40752 targetIndex += targetChunkLength;
40753 }
40754
40755 if (targetIndex < target.length) {
40756 padArrayChunk({
40757 source: [],
40758 target: target,
40759 start: targetIndex,
40760 getData: getChunkData
40761 });
40762 }
40763
40764 return target;
40765}
40766},{}],"EB5M":[function(require,module,exports) {
40767
40768"use strict";

Callers

nothing calls this directly

Calls 3

padArrayChunkFunction · 0.70
getDataFunction · 0.50
minMethod · 0.45

Tested by

no test coverage detected