Skip to content

Commit

Permalink
Update __spreadArray helper (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Jun 11, 2021
1 parent 4f0f29b commit 1f2daa7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tslib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export declare function __read(o: any, n?: number): any[];
export declare function __spread(...args: any[][]): any[];
/** @deprecated since TypeScript 4.2 */
export declare function __spreadArrays(...args: any[][]): any[];
export declare function __spreadArray(to: any[], from: any[]): any[];
export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[];
export declare function __await(v: any): any;
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
export declare function __asyncDelegator(o: any): any;
Expand Down
12 changes: 8 additions & 4 deletions tslib.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,14 @@ export function __spreadArrays() {
return r;
}

export function __spreadArray(to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
export function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || from);
}

export function __await(v) {
Expand Down
12 changes: 8 additions & 4 deletions tslib.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,14 @@ var __createBinding;
return r;
};

__spreadArray = function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
__spreadArray = function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || from);
};

__await = function (v) {
Expand Down

0 comments on commit 1f2daa7

Please sign in to comment.