Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/cli/wsh.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,39 @@ var wshapi = (function(){
};
}

//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
if (!Array.prototype.map)
{
Array.prototype.map = function(fun /*, thisArg */ ) {
"use strict";

if (this === void 0 || this === null) {
throw new TypeError();
}

var t = Object(this);
var len = t.length >>> 0;
if (typeof fun !== "function") {
throw new TypeError();
}

var res = new Array(len);
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
for (var i = 0; i < len; i++) {
// NOTE: Absolute correctness would demand Object.defineProperty
// be used. But this method is fairly new, and failure is
// possible only if Object.prototype or Array.prototype
// has a property |i| (very unlikely), so use a less-correct
// but more portable alternative.
if (i in t) {
res[i] = fun.call(thisArg, t[i], i, t);
}
}

return res;
};
}

function traverseDir(files, path) {
var filename, folder = fso.GetFolder(path),
subFlds, fc = new Enumerator(folder.files);
Expand Down