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