linx-simulator2/node_modules/remove-value/index.js
2019-09-18 11:11:16 +03:00

17 lines
284 B
JavaScript

'use strict';
module.exports = function( array, value, count ){
if (Array.isArray(this)) {
count = value;
value = array;
array = this;
}
var index;
var i = 0;
while ((!count || i++ < count) && ~(index = array.indexOf(value)))
array.splice(index, 1);
return array;
};