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


TypeScript underscore.without函数代码示例

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


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

示例1: function

		events.forEach(function(e){
			var eventName = e.trim();
			if(!that.callbacks){
				that.callbacks = {};
			}
			if(!that.callbacks[eventName]){
				that.callbacks[eventName] = [];
			}
			if(!cb){
				that.callbacks[eventName].pop();
			}
			else{
				that.callbacks[eventName] = _.without(
					that.callbacks[eventName], _.find(
						that.callbacks[eventName], function(item){
							return item.toString() === cb.toString()
						}
					)
				);
			}

			var propertiesChain = eventName.split('.');
			if(propertiesChain.length > 1){
				var prop = propertiesChain[0];
				propertiesChain.splice(0, 1);
				if(!this[prop] || !this[prop].on){
					throw "Property " + prop + " is undefined in " + eventName;
				}
				this[prop].unbind(propertiesChain.join('.'));
			}
		}.bind(this));
开发者ID:entcore,项目名称:infra-front,代码行数:31,代码来源:lib.ts

示例2: onToggleAlaCarte

 onToggleAlaCarte(alaCarteId: string) {
   if(_.contains(this.selectedAlaCarteIds, alaCarteId)){
     this.selectedAlaCarteIds = 
       _.without(this.selectedAlaCarteIds, alaCarteId);
   } else {
     this.selectedAlaCarteIds.push(alaCarteId);
   }
 }
开发者ID:SkillitCooking,项目名称:app1.0,代码行数:8,代码来源:cook-select.ts

示例3: expect

        unsubscribe = store.subscribe(() => {
            expect(store.getState().status).toBe(GameStatus.VOTE_DOCTOR);
            expect(store.getState().active_roles).toEqual([Roles.DOCTOR]);
            expect(store.getState().vote_variants).toEqual(_.without(_.pluck(store.getState().players, 'token'), store.getState().prev_round_healing));
            expect(store.getState().votes).toEqual([{who_token: doctor, for_whom_token: healing}]);

            // Отписываемся т. к. store общий для всех тестов
            unsubscribe();
            done();
        });
开发者ID:andreevWork,项目名称:mafia,代码行数:10,代码来源:FirstScenario.ts

示例4: destroy

    /**
     * Destroy a record based on it's unique key
     * @param id - the unique identifier value to locate the record
     * @param uniqueKey - the unique identifier field name e.g. 'id'
     * @returns {boolean}
     */
    destroy(id, uniqueKey:string = this._defaultUniqueKey) {
        var criteria = {};
        criteria[uniqueKey] = id;

        var match = _.findWhere(this._rows, criteria);
        if (match) {
            this._rows = _.without(this._rows, match);
            return this.save();
        } else {
            return false;
        }
    }
开发者ID:lorddoig,项目名称:lsdb,代码行数:18,代码来源:lsdb.ts

示例5: sendLike

  sendLike(idPost, l, n) {
    let checkUser: Boolean;
    let idUser = Meteor.userId();

    if (l.length === 0) {
      checkUser = false;
    } else {
      for (let i = 0; i < l.length; i++) {
        checkUser = idUser === _.property('idUser')(l[i]);
        if (checkUser === true) {
          break;
        }
      }
    }

    let name = Meteor.users.findOne(Meteor.userId()).profile.name;

    if (checkUser === false) {
      l.push({
        idUser: idUser,
        name: name,
      });

      Meteor.call('simpanTimeLine', {
        dateTime: new Date(),
        status: 'like',
        message: `${name} likes ${n}'s post`
      }, (error) => {
        if (error) {
          console.log(error);
        }
      });

    } else {
      l = _.without(l, _.findWhere(l, {
        idUser: Meteor.userId(),
        name: name,
      }));
    }

    Posts.update(
      {
        _id: idPost
      }, {
        $set: {
          likes: l
        }
      }
    );

  }
开发者ID:RizkiMufrizal,项目名称:Socially-Angular2-Meteor,代码行数:51,代码来源:post-component.ts

示例6: doUpdate

    /**
     * Internal method used to actually perform updates.
     * @private
     * @param rowAttrs
     * @param save
     * @param uniqueKey
     * @returns {boolean}
     */
    private doUpdate(rowAttrs:any, save?:boolean, uniqueKey:string = this._defaultUniqueKey) {
        var toUpdate = this.deepClone(rowAttrs);
        var criteria = {};
        var record;

        criteria[uniqueKey] = toUpdate[uniqueKey];
        record = _.findWhere(this._rows, criteria);

        if (_.isEmpty(record)) return false;

        var updatedRecord = this.merge(record, toUpdate);
        var rows = _.without(this._rows, record);
        rows.push(updatedRecord);

        this._rows = rows;
        return (save ? this.save() : true);
    }
开发者ID:lorddoig,项目名称:lsdb,代码行数:25,代码来源:lsdb.ts

示例7: it

    it('2 ночь путана проголосует и это уже не имеет значения', (done) => {
        let unsubscribe;

        real_man = _.last(_.without(_.pluck(_.where(store.getState().players, {role: Roles.INHABITANT}), 'token'), mafia_target));

        unsubscribe = store.subscribe(() => {
            expect(store.getState().status).toBe(GameStatus.VOTE_WHORE);
            expect(store.getState().active_roles).toEqual([Roles.WHORE]);
            expect(store.getState().vote_variants).toEqual(_.pluck(store.getState().players.filter(player => player.token !== whore), 'token'));
            expect(store.getState().votes).toEqual([{who_token: whore, for_whom_token: real_man}]);

            // Отписываемся т. к. store общий для всех тестов
            unsubscribe();
            done();
        });

        store.dispatch(GameAction.vote(
            whore,
            real_man
        ));
    });
开发者ID:andreevWork,项目名称:mafia,代码行数:21,代码来源:FirstScenario.ts

示例8: build

  public build(): HTMLElement {
    const clear = $$(
      'span',
      {
        className: 'coveo-facet-breadcrumb-clear'
      },
      SVGIcons.icons.mainClear
    );

    const pathToRender = without(this.categoryValueDescriptor.path, ...this.categoryFacet.options.basePath);
    const captionLabel = pathToRender.map(pathPart => this.categoryFacet.getCaption(pathPart)).join('/');

    const breadcrumbTitle = $$('span', { className: 'coveo-category-facet-breadcrumb-title' }, `${this.categoryFacet.options.title}:`);
    const valuesContainer = $$('span', { className: 'coveo-category-facet-breadcrumb-values' }, captionLabel, clear);

    new AccessibleButton()
      .withElement(valuesContainer)
      .withLabel(l('RemoveFilterOn', captionLabel))
      .withSelectAction(this.onClickHandler)
      .build();

    const breadcrumb = $$('span', { className: 'coveo-category-facet-breadcrumb' }, breadcrumbTitle, valuesContainer);
    return breadcrumb.el;
  }
开发者ID:coveo,项目名称:search-ui,代码行数:24,代码来源:CategoryFacetBreadcrumb.ts


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