typescript-dotnet-core
Version:
A the core classes and utilities of a JavaScript-Friendly .NET Based TypeScript Library.
7 lines (6 loc) • 1.69 kB
JavaScript
;
/*!
* @author electricessence / https://github.com/electricessence/
* Licensing: MIT https://github.com/electricessence/TypeScript.NET-Core/blob/master/LICENSE.md
*/Object.defineProperty(exports,"__esModule",{value:!0});var initialize_1=require("./initialize"),ArgumentNullException_1=require("../../Exceptions/ArgumentNullException"),ArgumentOutOfRangeException_1=require("../../Exceptions/ArgumentOutOfRangeException");function copy(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1/0),e?copyTo(e,initialize_1.default(Math.min(n,Math.max(e.length-t,0))),t,0,n):e}exports.copy=copy;var CBN="Cannot be null.",CBL0="Cannot be less than zero.";function copyTo(e,t,n,o,i){if(void 0===n&&(n=0),void 0===o&&(o=0),void 0===i&&(i=1/0),!e)throw new ArgumentNullException_1.default("source",CBN);if(!t)throw new ArgumentNullException_1.default("destination",CBN);if(n<0)throw new ArgumentOutOfRangeException_1.default("sourceIndex",n,CBL0);var r=e.length;if(!r)return t;if(r<=n)throw new ArgumentOutOfRangeException_1.default("sourceIndex",n,"Must be less than the length of the source array.");if(t.length<0)throw new ArgumentOutOfRangeException_1.default("destinationIndex",o,CBL0);var u=e.length-n;if(isFinite(i)&&u<i)throw new ArgumentOutOfRangeException_1.default("sourceIndex",n,"Source index + length cannot exceed the length of the source array.");var a=o+(i=Math.min(i,u));a>t.length&&(t.length=a);for(var c=0;c<i;c++)t[o+c]=e[n+c];return t}!function(r){r.to=function(e,t,n,o,i){return void 0===n&&(n=0),void 0===o&&(o=0),void 0===i&&(i=1/0),r.to(e,t,n,o,i)}}(copy=exports.copy||(exports.copy={})),exports.copyTo=copyTo,exports.default=copy;
//# sourceMappingURL=copy.js.map