当前位置: 首页>>代码示例>>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;未经允许,请勿转载。