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


TypeScript lodash.reject函数代码示例

本文整理汇总了TypeScript中lodash.reject函数的典型用法代码示例。如果您正苦于以下问题:TypeScript reject函数的具体用法?TypeScript reject怎么用?TypeScript reject使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reject函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

const getColumnsAndRelated = (columns) => {
  const withRelated = [];

  if(_.includes(columns, 'organizationalunit.name')) {
    columns.push('organizationalunitId');
    withRelated.push('organizationalunit');
    columns = _.reject(columns, testCol => testCol === 'organizationalunit.name');
  }

  if(_.includes(columns, 'location.name')) {
    columns.push('locationId');
    withRelated.push('location');
    columns = _.reject(columns, testCol => testCol === 'location.name');
  }

  const vendorKeys = ['vendors[0].name', 'vendors[0].stockId', 'vendors[0].cost'];

  if(_.some(vendorKeys, key => _.includes(columns, key))) {
    columns.push('id');
    withRelated.push('vendors');
    _.each(vendorKeys, key => columns = _.reject(columns, testCol => testCol === key));
  }

  _.each(columns, col => {
    if(!_.includes(col, '.length')) { return; }
    columns = _.reject(columns, testCol => testCol === col);
  });

  return { columns: _.uniq(columns), withRelated };
};
开发者ID:Linko91,项目名称:posys,代码行数:30,代码来源:report.ts

示例2:

        ]).spread((uiDescriptor) => {
            let vm = parentContext.object,
                devices: any = _.map(
                _.reject(vm.devices, {type: this.vmRepository.DEVICE_TYPE.VOLUME}),
                device => _.assign(device, {
                    _objectType: Model.VmDevice,
                    _vm: vm,
                    id: uuid.v4()
                })
            );
            context.object = devices;
            context.object._vm = vm;
            context.object._objectType = Model.VmDevice;
            context.userInterfaceDescriptor = uiDescriptor;
            context.changeListener = this.eventDispatcherService.addEventListener('VmDevicesChanged-' + (vm.id || 'new'), (newDevices) => {
                context.object = _.map(
                    _.reject(newDevices, {type: this.vmRepository.DEVICE_TYPE.VOLUME}),
                    device => _.assign(device, {
                        _objectType: Model.VmDevice,
                        _vm: vm,
                        id: uuid.v4()
                    })
                );
                context.object._vm = vm;
                context.object._objectType = Model.VmDevice;
            });


            return this.updateStackWithContext(this.stack, context);
        });
开发者ID:mactanxin,项目名称:gui,代码行数:30,代码来源:vms.ts

示例3: function

        $scope.tallennaTekstikappaleet = function(tekstikentat) {
            var filtered = _.reject(tekstikentat, function(tk: any) {
                return tk.$ladattu === true;
            });
            var doneSuccess = _.after(_.size(filtered), function() {
                Notifikaatiot.onnistui("tallennus-onnistui");
                $scope.uploadSuccessTekstikappaleet = true;
            });

            _.forEach(filtered, function(tk: any) {
                tk.tila = "luonnos";
                tk.osanTyyppi = "tekstikappale";
                var viite = { perusteenOsa: tk };
                SuoritustapaSisalto.save(
                    {
                        perusteId: $scope.haettuPeruste.id,
                        suoritustapa: $scope.suoritustapa || $scope.haettuPeruste.suoritustavat[0].suoritustapakoodi
                    },
                    viite,
                    function(re) {
                        tk.$ladattu = true;
                        tk.id = re._perusteenOsa;
                        doneSuccess();
                    },
                    function(err) {
                        tk.$syy = err.data.syy;
                    }
                );
            });
        };
开发者ID:Opetushallitus,项目名称:eperusteet,代码行数:30,代码来源:excel.ts

示例4: _transformUtxos

  _transformUtxos(unspent, bcheight) {
    $.checkState(bcheight > 0, 'No BC height passed to _transformUtxos');
    const ret = _.map(
      _.reject(unspent, x => {
        return x.spentHeight && x.spentHeight <= -3;
      }),
      x => {
        const u = {
          address: x.address,
          satoshis: x.value,
          amount: x.value / 1e8,
          scriptPubKey: x.script,
          txid: x.mintTxid,
          vout: x.mintIndex,
          locked: false,
          confirmations: x.mintHeight > 0 && bcheight >= x.mintHeight ? bcheight - x.mintHeight + 1 : 0
        };

        // v8 field name differences
        return u;
      }
    );

    return ret;
  }
开发者ID:bitpay,项目名称:bitcore,代码行数:25,代码来源:v8.ts

示例5: reject

export const translatePackFromDB = (
  pack: StickerPackDBType,
  packs: Dictionary<StickerPackDBType>,
  blessedPacks: Dictionary<boolean>,
  stickersPath: string,
  tempPath: string
) => {
  const { id, stickers, status, coverStickerId } = pack;
  const isEphemeral = status === 'ephemeral';

  // Sometimes sticker packs have a cover which isn't included in their set of stickers.
  //   We don't want to show cover-only images when previewing or picking from a pack.
  const filteredStickers = reject(
    values(stickers),
    sticker => sticker.isCoverOnly
  );
  const translatedStickers = map(filteredStickers, sticker =>
    translateStickerFromDB(sticker, stickersPath, tempPath, isEphemeral)
  );

  return {
    ...pack,
    isBlessed: Boolean(blessedPacks[id]),
    cover: getSticker(packs, id, coverStickerId, stickersPath, tempPath),
    stickers: sortBy(translatedStickers, sticker => sticker.id),
  };
};
开发者ID:WhisperSystems,项目名称:Signal-Desktop,代码行数:27,代码来源:stickers.ts

示例6: affectedFixtures

export function affectedFixtures(changedFiles: string[] | undefined = undefined): Fixture[] {
  if (changedFiles === undefined) {
    const { BUILDKITE_PULL_REQUEST_BASE_BRANCH: base, BUILDKITE_COMMIT: commit } = process.env;
    return commit === undefined ? allFixtures : affectedFixtures(getChangedFiles(base || "master", commit));
  }

  // We can ignore changes in Markdown files
  changedFiles = _.reject(changedFiles, file => _.endsWith(file, ".md"));

  // All fixtures are dirty if any changed file is not included as a sourceFile of some fixture.
  const fileDependencies = _.flatMap(allFixtures, f => f.language.sourceFiles || []);
  const allFixturesDirty = _.some(changedFiles, f => !_.includes(fileDependencies, f));

  if (allFixturesDirty) return allFixtures;

  const dirtyFixtures = allFixtures.filter(
    fixture =>
      // Fixtures that don't specify dependencies are always dirty
      fixture.language.sourceFiles === undefined ||
      // Fixtures that have a changed file are dirty
      _.some(changedFiles, f => _.includes(fixture.language.sourceFiles, f))
  );

  return dirtyFixtures;
}
开发者ID:nrkn,项目名称:quicktype,代码行数:25,代码来源:buildkite.ts

示例7: runExpire

  private runExpire(): void {
    if (this.cache.length <= 0) return;

    this.cache = _.reject(this.cache, c => {
      return c.addedAt < Moment().subtract(this.expiry, "minutes");
    });
  }
开发者ID:frankhale,项目名称:toby,代码行数:7,代码来源:searchCache.ts

示例8: function

 $scope.getTavoitteet = function(alue, pakollinen) {
     if (pakollinen) {
         return alue.$groups ? _.filter(alue.$groups.grouped[alue.$chosen], "pakollinen") : [];
     }
     var grouped = alue.$groups ? _.reject(alue.$groups.grouped[alue.$chosen], "pakollinen") : [];
     var ungrouped = alue.$groups ? alue.$groups.ungrouped : [];
     return grouped.concat(ungrouped);
 };
开发者ID:Opetushallitus,项目名称:eperusteet,代码行数:8,代码来源:tutke2osa.ts

示例9: removeOutlineNodesInternal

function removeOutlineNodesInternal(outline:IOutlineNode,
                                    predicate:(outline:IOutlineNode) => boolean):IOutlineNode {

    let filteredChildren = _.reject(outline.children, predicate)
    outline.children = filteredChildren

    _.forEach(outline.children, (currChild) => removeOutlineNodesInternal(currChild, predicate))

    return outline
}
开发者ID:VILOZNY,项目名称:chevrotain,代码行数:10,代码来源:outline.ts


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