本文整理汇总了TypeScript中lodash.remove函数的典型用法代码示例。如果您正苦于以下问题:TypeScript remove函数的具体用法?TypeScript remove怎么用?TypeScript remove使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
}).then(function (deleteTenant) {
if (deleteTenant) {
if (tenant.id) {
that.TenantService.delete(tenant).then(function () {
that.NotificationService.show("Tenant '" + tenant.name + "' deleted with success");
_.remove(that.tenants, tenant);
});
} else {
_.remove(that.tenantsToCreate, tenant);
_.remove(that.tenants, tenant);
}
}
});
示例2: it
it('should spawn a child process', () => {
let expectedWorkerProcessPath = path.resolve(__dirname + '/../../../src/isolated-runner/') + '/IsolatedTestRunnerAdapterWorker';
let expectedExecArgv = _.clone(process.execArgv);
_.remove(expectedExecArgv, arg => arg.substr(0, 11) === '--debug-brk');
expect(child_process.fork).to.have.been.calledWith(expectedWorkerProcessPath, [], { execArgv: expectedExecArgv, silent: true });
expect(fakeChildProcess.on).to.have.been.calledWith('message');
});
示例3: toggleSubPathSelection
toggleSubPathSelection(source: ActionSource, subIdx: number) {
const selections = [...this.getSelections()];
_.remove(selections, s => s.type !== SelectionType.SubPath || s.source !== source);
const type = SelectionType.SubPath;
const toggledSelections = this.toggleSelections(selections, [{ type, source, subIdx }]);
this.store.dispatch(new SetActionModeSelections(toggledSelections));
}
示例4: function
successCb: function() {
$scope.editablePeruste.koulutukset = _.remove($scope.editablePeruste.koulutukset, function(
koulutus
) {
return (koulutus as any).koulutuskoodiArvo !== koulutuskoodiArvo;
});
}
示例5: set
set(title, text, severity, timeout) {
if (_.isObject(text)) {
console.log('alert error', text);
if (text.statusText) {
text = `HTTP Error (${text.status}) ${text.statusText}`;
}
}
var newAlert = {
title: title || '',
text: text || '',
severity: severity || 'info',
};
var newAlertJson = angular.toJson(newAlert);
// remove same alert if it already exists
_.remove(this.list, function(value) {
return angular.toJson(value) === newAlertJson;
});
this.list.push(newAlert);
if (timeout > 0) {
this.$timeout(() => {
this.list = _.without(this.list, newAlert);
}, timeout);
}
if (!this.$rootScope.$$phase) {
this.$rootScope.$digest();
}
return(newAlert);
}
示例6: removeFilter
removeFilter(field, key, silent) {
let filters = _.remove(this.filters, (current) => {
return current.key === field + '_' + key;
});
if (filters.length > 0) {
this.lastSource = filters[0].source;
}
let fieldObject = this.fields[field] || {filters: {}};
let fieldFilter = fieldObject.filters[key];
if (fieldFilter) {
delete fieldObject.filters[key];
// Is there a registered event ?
if (fieldFilter.onRemove && !silent) {
fieldFilter.onRemove(key);
}
}
if (Object.keys(fieldObject.filters).length === 0 || _.isEmpty(fieldObject.filters)) {
delete fieldObject.filters;
}
if (! _.isEmpty(fieldObject.filters)) {
fieldObject.query = '(' + field + ":" + _.map(_.keys(fieldObject.filters)).join(' OR ') + ')';
this.fields[field] = fieldObject;
} else {
delete this.fields[field];
}
this.createAndSendQuery(silent);
}
示例7: resetTSClassProperty
export function resetTSClassProperty (body) {
for (const method of body) {
if (t.isClassMethod(method) && method.kind === 'constructor') {
for (const statement of cloneDeep(method.body.body)) {
if (t.isExpressionStatement(statement) && t.isAssignmentExpression(statement.expression)) {
const expr = statement.expression
const { left, right } = expr
if (
t.isMemberExpression(left) &&
t.isThisExpression(left.object) &&
t.isIdentifier(left.property)
) {
if (
(t.isArrowFunctionExpression(right) || t.isFunctionExpression(right)) ||
(left.property.name === 'config' && t.isObjectExpression(right))
) {
body.push(
t.classProperty(left.property, right)
)
remove(method.body.body, statement)
}
}
}
}
}
}
}
示例8: clear
async function clear(method?: string, requestPayload?: any) {
if (method && requestPayload) {
let dataHash = await generateHash(requestPayload);
if (memCache[method] && memCache[method][dataHash]) {
delete memCache[method][dataHash];
diskCache.namespace(method).remove(dataHash);
let q = store.get(cacheQ) || [];
pull(q, `${method}.${dataHash}`);
store.set(cacheQ, q, true);
}
} else if (method && !requestPayload) {
delete memCache[method];
diskCache.namespace(method).clearAll();
let q = store.get(cacheQ) || [];
remove(q, (i: string) => i.split(".")[0] === method);
store.set(cacheQ, q, true);
} else if (!method && requestPayload) {
throw new Error("Invalid argument. Url is mandatory with requestPayload.");
} else {
memCache = {};
store.set(cacheQ, [], true);
diskCache.clearAll();
return;
}
}
示例9: deleteCourseById
deleteCourseById(id:string):Course {
let found = _.find(this.courses, course => course.id==id);
if(found) {
_ .remove(this.courses, found);
}
return found;
}
示例10:
router.put('/', (req: express.Request, res: express.Response) => {
let group = _.find(result, (group) => {
return group.name === req.body.group;
});
if (!group) {
res.status(400).end(`group ${req.body.group} not found`);
return;
}
let race = _.find(group.races, (race) => {
return race.name === req.body.race;
});
if (!race) {
res.status(400).end(`race ${req.body.race} not found`);
return;
}
let ship = _.find(race.ships, (ship) => {
return ship.name === req.body.name
});
if (!ship) {
res.status(400).end(`ship with the name ${req.body.name} not found`);
return;
}
_.remove(race.ships, ship);
race.ships.push(req.body);
res.status(204).end();
});