當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。