]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/vim-mode/node_modules/grim/node_modules/emissary/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/shim.js
45823be51fc1936a5a67516f34893f94fdebf5e9
1 // Taken from: https://github.com/paulmillr/es6-shim/
5 var toInteger
= require('../../../number/to-integer')
6 , toPosInt
= require('../../../number/to-pos-integer')
7 , validValue
= require('../../../object/valid-value')
9 , max
= Math
.max
, min
= Math
.min
;
11 module
.exports = function (value
/*, start, end*/) {
12 var o
= validValue(this), start
= arguments
[1], end
= arguments
[2]
13 , l
= toPosInt(o
.length
), relativeStart
, i
;
15 start
= (start
=== undefined) ? 0 : toInteger(start
);
16 end
= (end
=== undefined) ? l : toInteger(end
);
18 relativeStart
= start
< 0 ? max(l
+ start
, 0) : min(start
, l
);
19 for (i
= relativeStart
; i
< l
&& i
< end
; ++i
) o
[i
] = value
;