當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Immutable.is函數代碼示例

本文整理匯總了TypeScript中Immutable.is函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript is函數的具體用法?TypeScript is怎麽用?TypeScript is使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了is函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test

  test("merges streams of text", () => {
    let outputs = Immutable.List();

    outputs = reduceOutputs(outputs, {
      name: "stdout",
      text: "hello",
      output_type: "stream"
    });
    expect(
      Immutable.is(
        outputs,
        Immutable.fromJS([makeStreamOutput({ name: "stdout", text: "hello" })])
      )
    ).toBe(true);

    outputs = reduceOutputs(outputs, {
      name: "stdout",
      text: " world",
      output_type: "stream"
    });
    expect(
      Immutable.is(
        outputs,
        Immutable.fromJS([
          makeStreamOutput({ name: "stdout", text: "hello world" })
        ])
      )
    ).toBe(true);
  });
開發者ID:kelleyblackmore,項目名稱:nteract,代碼行數:29,代碼來源:document.spec.ts

示例2: it

  it('expresses value equality with set sequences', () => {
    var s1 = Set.of('A', 'B', 'C');
    expect(s1.equals(null)).toBe(false);

    var s2 = Set.of('C', 'B', 'A');
    expect(s1 === s2).toBe(false);
    expect(is(s1, s2)).toBe(true);
    expect(s1.equals(s2)).toBe(true);

    // Map and Set are not the same (keyed vs unkeyed)
    var v1 = Map({ A: 'A', C: 'C', B: 'B' });
    expect(is(s1, v1)).toBe(false);
  });
開發者ID:Harishs84,項目名稱:immutable-js,代碼行數:13,代碼來源:Set.ts

示例3: it

 it('surfaces NaN, null, and undefined', () => {
   expect(
     is(NaN, Seq.of(1, 2, 3, 4, 5, NaN).max())
   ).toBe(true);
   expect(
     is(NaN, Seq.of(NaN, 1, 2, 3, 4, 5).max())
   ).toBe(true);
   expect(
     is(null, Seq.of('A', 'B', 'C', 'D', null).max())
   ).toBe(true);
   expect(
     is(null, Seq.of(null, 'A', 'B', 'C', 'D').max())
   ).toBe(true);
 });
開發者ID:AntanasBarauskas,項目名稱:immutable-js,代碼行數:14,代碼來源:minmax.ts

示例4: function

 compare: function(actual, expected) {
   var passed = is(actual, expected);
   return {
     pass: passed,
     message: 'Expected ' + actual + (passed ? '' : ' not') + ' to equal ' + expected
   };
 }
開發者ID:Harishs84,項目名稱:immutable-js,代碼行數:7,代碼來源:concat.ts

示例5: it

 it('should initialize a game state record with default values', () => {
   const choices = I.List([3, 4, 5]);
   const correctChoice = 4;
   const refreshChoices = spy(
     (game: TestState) => game.set('choices', choices)
   );
   const refreshCorrectChoice = spy(
     (game: TestState) => game.set('correctChoice', correctChoice)
   );
   const game = init(new TestStateRecord(), refreshChoices, refreshCorrectChoice);
   assert.strictEqual(refreshChoices.callCount, 1);
   assert.strictEqual(refreshCorrectChoice.callCount, 1);
   assert.strictEqual(game.level, 1);
   assert.strictEqual(game.step, 0);
   assert(I.is(game.choices, choices));
   assert.strictEqual(game.correctChoice, correctChoice);
   assert.strictEqual(game.lastGuess, null);
   assert.strictEqual(game.wasLastGuessCorrect, null);
   assert.strictEqual(game.presentCount, 0);
   assert.strictEqual(game.guessCount, 0);
   assert.strictEqual(game.guessCountForCurrentCorrectChoice, 0);
   assert.strictEqual(game.shouldRefreshChoices, false);
   assert.strictEqual(game.shouldRefreshCorrectChoice, false);
   assert.strictEqual(game.refreshChoicesCount, 1);
   assert.strictEqual(game.refreshCorrectChoiceCount, 1);
 });
開發者ID:agaricus,項目名稱:ear-sharpener,代碼行數:26,代碼來源:test.ts

示例6: expect

 check.it('is not dependent on order', [genHeterogeneousishArray], vals => {
   expect(
     is(
       Seq(shuffle(vals.slice())).max(),
       Seq(vals).max()
     )
   ).toEqual(true);
 });
開發者ID:AntanasBarauskas,項目名稱:immutable-js,代碼行數:8,代碼來源:minmax.ts

示例7: emit

 emit(value:any) {
   if (!refValues.has(this.key()) || !Immutable.is(refValues.get(this.key()), value)) {
     const listeners = refListeners.get(this.key());
     if (listeners) {
       refValues.set(this.key(), value);
       listeners.forEach(listener => listener(value));
     }
   }
 }
開發者ID:barbuza,項目名稱:kebaka,代碼行數:9,代碼來源:ref.ts

示例8: Map

 check.it('sets', {maxSize: 5000}, [gen.posInt], len => {
   var map = Map();
   for (var ii = 0; ii < len; ii++) {
     expect(map.size).toBe(ii);
     map = map.set(''+ii, ii);
   }
   expect(map.size).toBe(len);
   expect(is(map.toSet(), Range(0, len).toSet())).toBe(true);
 });
開發者ID:threehams,項目名稱:immutable-js,代碼行數:9,代碼來源:Map.ts


注:本文中的Immutable.is函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。