move arrayRemove to lang
This commit is contained in:
parent
a7963dc9a4
commit
c0540f7e1e
4 changed files with 15 additions and 16 deletions
|
|
@ -39,7 +39,7 @@ define(function(require, exports, module) {
|
|||
|
||||
|
||||
var console = require('pilot/console');
|
||||
var util = require('pilot/util');
|
||||
var lang = require('pilot/lang');
|
||||
var oop = require('pilot/oop');
|
||||
var EventEmitter = require('pilot/event_emitter').EventEmitter;
|
||||
|
||||
|
|
@ -1048,7 +1048,7 @@ oop.inherits(CliRequisition, Requisition);
|
|||
}
|
||||
}
|
||||
|
||||
util.arrayRemove(names, assignment.name);
|
||||
lang.arrayRemove(names, assignment.name);
|
||||
args.splice(i, 1);
|
||||
// We don't need to i++ if we splice
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ var EventEmitter = require('pilot/event_emitter').EventEmitter;
|
|||
var catalog = require('pilot/catalog');
|
||||
var Status = require('pilot/types').Status;
|
||||
var types = require('pilot/types');
|
||||
var util = require('pilot/util');
|
||||
var lang = require('pilot/lang');
|
||||
|
||||
/*
|
||||
// TODO: this doesn't belong here - or maybe anywhere?
|
||||
|
|
@ -153,7 +153,7 @@ function upgradeType(param) {
|
|||
function removeCommand(command) {
|
||||
var name = (typeof command === 'string' ? command : command.name);
|
||||
delete commands[name];
|
||||
util.arrayRemove(commandNames, name);
|
||||
lang.arrayRemove(commandNames, name);
|
||||
};
|
||||
|
||||
function getCommand(name) {
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -618,16 +618,4 @@ exports.rectsEqual = function(r1, r2, delta) {
|
|||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue