本文整理汇总了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));
})
示例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
};
}
示例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);
}),
示例4:
.update('plugins', (x) => {
// Ensure next transformation is always dealing with a List
if (!Imm.List.isList(x)) {
return Imm.List([x]);
}
return x;
})
示例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']);
});
示例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));
};
示例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]);
}
示例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, []];
}
示例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, []];
}
示例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;
}
};