more beauty way to create array with original keys

This commit is contained in:
sanex3339
2017-01-06 02:05:51 +03:00
parent 105ad55c06
commit b137e7bf01
3 changed files with 346 additions and 348 deletions
+343 -345
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -34,7 +34,7 @@
"reflect-metadata": "^0.1.9",
"source-map-support": "0.4.8",
"string-template": "^1.0.0",
"tslib": "^1.4.0"
"tslib": "^1.5.0"
},
"devDependencies": {
"@types/chai": "3.4.34",
@@ -47,7 +47,7 @@
"@types/lodash": "^4.14.45",
"@types/mkdirp": "0.3.29",
"@types/mocha": "2.2.35",
"@types/node": "6.0.56",
"@types/node": "6.0.57",
"@types/sinon": "1.16.34",
"@types/string-template": "1.0.2",
"awesome-typescript-loader": "3.0.0-beta.17",
@@ -57,7 +57,7 @@ export class BlockStatementControlFlowReplacer extends AbstractControlFlowReplac
}
const blockStatementBody: ESTree.Statement[] = blockStatementNode.body;
const originalKeys: number[] = Object.keys(blockStatementBody).map((key: string) => parseInt(key, 10));
const originalKeys: number[] = Array.from(Array(blockStatementBody.length).keys());
const shuffledKeys: number[] = Utils.arrayShuffle(originalKeys);
const originalKeysIndexesInShuffledArray: number[] = originalKeys.map((key: number) => shuffledKeys.indexOf(key));