当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript lodash.remove函数代码示例

本文整理汇总了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);
     }
   }
 });
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:13,代码来源:tenants.controller.ts

示例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');
 });
开发者ID:devlucas,项目名称:stryker,代码行数:7,代码来源:IsolatedTestRunnerAdapterSpec.ts

示例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));
 }
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:7,代码来源:actionmode.service.ts

示例4: function

 successCb: function() {
     $scope.editablePeruste.koulutukset = _.remove($scope.editablePeruste.koulutukset, function(
         koulutus
     ) {
         return (koulutus as any).koulutuskoodiArvo !== koulutuskoodiArvo;
     });
 }
开发者ID:Opetushallitus,项目名称:eperusteet,代码行数:7,代码来源:perusteenTiedot.ts

示例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);
  }
开发者ID:joelanford,项目名称:grafana,代码行数:34,代码来源:alert_srv.ts

示例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);
  }
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:33,代码来源:dashboard-filter.controller.ts

示例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)
            }
          }
        }
      }
    }
  }
}
开发者ID:YangShaoQun,项目名称:taro,代码行数:27,代码来源:helper.ts

示例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;
  }
}
开发者ID:pranavjindal999,项目名称:Youtube-Material,代码行数:25,代码来源:index.ts

示例9: deleteCourseById

 deleteCourseById(id:string):Course {
   let found = _.find(this.courses, course => course.id==id);
   if(found) {
   _ .remove(this.courses, found);
   }
   return found; 
 }
开发者ID:joonhwan,项目名称:LobInAngular,代码行数:7,代码来源:courseApi.ts

示例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();
});
开发者ID:dimkinv,项目名称:eve-static-server,代码行数:32,代码来源:ships.ts


注:本文中的lodash.remove函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。