File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,39 @@ var wshapi = (function(){
7373 } ;
7474 }
7575
76+ //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
77+ if ( ! Array . prototype . map )
78+ {
79+ Array . prototype . map = function ( fun /*, thisArg */ ) {
80+ "use strict" ;
81+
82+ if ( this === void 0 || this === null ) {
83+ throw new TypeError ( ) ;
84+ }
85+
86+ var t = Object ( this ) ;
87+ var len = t . length >>> 0 ;
88+ if ( typeof fun !== "function" ) {
89+ throw new TypeError ( ) ;
90+ }
91+
92+ var res = new Array ( len ) ;
93+ var thisArg = arguments . length >= 2 ? arguments [ 1 ] : void 0 ;
94+ for ( var i = 0 ; i < len ; i ++ ) {
95+ // NOTE: Absolute correctness would demand Object.defineProperty
96+ // be used. But this method is fairly new, and failure is
97+ // possible only if Object.prototype or Array.prototype
98+ // has a property |i| (very unlikely), so use a less-correct
99+ // but more portable alternative.
100+ if ( i in t ) {
101+ res [ i ] = fun . call ( thisArg , t [ i ] , i , t ) ;
102+ }
103+ }
104+
105+ return res ;
106+ } ;
107+ }
108+
76109 function traverseDir ( files , path ) {
77110 var filename , folder = fso . GetFolder ( path ) ,
78111 subFlds , fc = new Enumerator ( folder . files ) ;
You can’t perform that action at this time.
0 commit comments