move arrayRemove to lang

This commit is contained in:
Fabian Jakobs 2010-12-16 18:22:34 +01:00
commit c0540f7e1e
4 changed files with 15 additions and 16 deletions

View file

@ -62,6 +62,17 @@ exports.arrayToMap = function(arr) {
};
/**
* splice out of 'array' anything that === 'value'
*/
exports.arrayRemove = function(array, value) {
for (var i = 0; i <= array.length; i++) {
if (value === array[i]) {
array.splice(i, 1);
}
}
};
exports.escapeRegExp = function(str) {
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
};