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


TypeScript List.isList方法代码示例

本文整理汇总了TypeScript中Immutable.List.isList方法的典型用法代码示例。如果您正苦于以下问题:TypeScript List.isList方法的具体用法?TypeScript List.isList怎么用?TypeScript List.isList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Immutable.List的用法示例。


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

示例1: it

 it('always returns the same type', () => {
   var a = Set.of(1,2,3);
   var b = List();
   expect(b.concat(a)).not.toBe(a);
   expect(List.isList(b.concat(a))).toBe(true);
   expect(b.concat(a)).is(List.of(1,2,3));
 })
开发者ID:AntanasBarauskas,项目名称:immutable-js,代码行数:7,代码来源:concat.ts

示例2: makeFilesArg

export function makeFilesArg(value) {
    let globs = [];
    let objs = [];

    if (_.isString(value)) {
        globs = globs.concat(explodeFilesArg(value));
    }

    if (List.isList(value) && value.size) {
        value.forEach(function(value) {
            if (_.isString(value)) {
                globs.push(value);
            } else {
                if (Map.isMap(value)) {
                    objs.push(value);
                }
            }
        });
    }

    return {
        globs: globs,
        objs: objs
    };
}
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:25,代码来源:cli-options.ts

示例3: flatMap

    flatMap(({ repoId, page }) => {
      if (List.isList(repoId)) {
        return fetchMapIssues(repoId as List<string>, store.value, page);
      }

      return fetchMapIssue(repoId as string, store.value, page);
    }),
开发者ID:alex3165,项目名称:github-issues,代码行数:7,代码来源:issues.ts

示例4:

 .update('plugins', (x) => {
     // Ensure next transformation is always dealing with a List
     if (!Imm.List.isList(x)) {
         return Imm.List([x]);
     }
     return x;
 })
开发者ID:b-cuts,项目名称:browser-sync-core,代码行数:7,代码来源:plugins.ts

示例5: it

  it('can compose Immutable::List initial states', () => {
    const state = compose(List.of('a', 'b'), List.of('c', 'd'), List.of());
    expect(List.isList(state)).to.be.true;

    const plain = state.toJS();
    expect(plain).not.to.be.null;
    expect(plain).to.deep.equal(['a', 'b', 'c', 'd']);
  });
开发者ID:danielfigueiredo,项目名称:ng2-redux-form,代码行数:8,代码来源:compose-reducers.test.ts

示例6: append

export const append = <A>($1: Stream<A>, $2: Stream<A>): Stream<A> => {
    if (isLazy($1)) return () => append($2, $1());
    if (List.isList($1) && $1.isEmpty()) return $2;

    const newList = append($1.shift(), $2);
    return (isLazy(newList))
        ? () => append(List([$1.get(0)]), newList)
        : newList.unshift($1.get(0));
};
开发者ID:joshcox,项目名称:microJSKanren,代码行数:9,代码来源:Stream.ts

示例7: transform

 transform(todos, args) {
   if (isBlank(args) || args.length === 0) {
     throw new BaseException('VisibleTodos pipe requires one argument');
   }
   if (isPresent(todos) && !List.isList(todos)) {
     return todos;
   }
   return this.getVisibleTodos(todos, args[0]);
 }
开发者ID:tedliang,项目名称:angular2-redux-starter,代码行数:9,代码来源:visible-pipe.ts

示例8: handleExtensionsOption

export function handleExtensionsOption(incoming: BsTempOptions): TransformResult {
    const value = incoming.get('extensions');
    if (_.isString(value)) {
        const split = explodeFilesArg(value);
        if (split.length) {
            return [incoming.set('extensions', List(split)), []];
        }
    }
    if (List.isList(value)) {
        return [incoming.set('extensions', value), []];
    }
    return [incoming, []];
}
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:13,代码来源:handleExtensionsOption.ts

示例9: addToFilesOption

export function addToFilesOption(incoming: BsTempOptions): TransformResult {
    if (!incoming.get("watch")) {
        return [incoming, []];
    }

    let serverPaths = [];

    const fromServeStatic = incoming
        .get("serveStatic", List([]))
        .toArray();
    const ssPaths = fromServeStatic
        .reduce((acc, ss) => {
            if (typeof ss === "string") {
                return acc.concat(ss);
            }
            if (ss.dir && typeof ss.dir === "string") {
                return acc.concat(ss);
            }
            return acc;
        }, []);

    ssPaths.forEach(p => serverPaths.push(p));

    const server = incoming.get("server");
    if (server) {
        if (server === true) {
            serverPaths.push(".");
        }
        if (typeof server === "string") {
            serverPaths.push(server);
        }
        if (
            List.isList(server) &&
            server.every(x => typeof x === "string")
        ) {
            server.forEach(s => serverPaths.push(s));
        }
        if (Map.isMap(server)) {
            const baseDirProp = server.get("baseDir");
            const baseDirs = List([]).concat(baseDirProp).filter(Boolean);
            baseDirs.forEach(s => serverPaths.push(s));
        }
    }

    const output = incoming.update("files", files => {
        return List([])
            .concat(files, serverPaths)
            .filter(Boolean);
    });
    return [output, []];
}
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:51,代码来源:addToFilesOption.ts

示例10: default

export default (state = initialState, action: LabelAction) => {
  const { type, payload } = action;

  switch (type) {
    case ADD_LABEL:
      if (List.isList(payload)) {
        const payloadBis = payload.reduce((acc, next) => {
          return acc.set(next.get('id'), next);
        }, OrderedMap<any, any>());

        return state.merge(payloadBis);
      }
    default:
      return state;
  }
};
开发者ID:alex3165,项目名称:github-issues,代码行数:16,代码来源:labels.ts


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