MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / getView

Function getView

lib/web/jshint.js:5502–5518  ·  view source on GitHub ↗

* Gets the view, applying any `transforms` to the `start` and `end` positions. * * @private * @param {number} start The start of the view. * @param {number} end The end of the view. * @param {Array} [transforms] The transformations to apply to the view. * @returns {Obje

(start, end, transforms)

Source from the content-addressed store, hash-verified

5500 * positions of the view.
5501 */
5502 function getView(start, end, transforms) {
5503 var index = -1,
5504 length = transforms ? transforms.length : 0;
5505
5506 while (++index < length) {
5507 var data = transforms[index],
5508 size = data.size;
5509
5510 switch (data.type) {
5511 case 'drop': start += size; break;
5512 case 'dropRight': end -= size; break;
5513 case 'take': end = nativeMin(end, start + size); break;
5514 case 'takeRight': start = nativeMax(start, end - size); break;
5515 }
5516 }
5517 return { 'start': start, 'end': end };
5518 }
5519
5520 /**
5521 * Initializes an array clone.

Callers 1

lazyValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected