本文整理汇总了TypeScript中ix/iterable/toArray.toArray函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toArray函数的具体用法?TypeScript toArray怎么用?TypeScript toArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toArray函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test(`json and arrow buffers report the same values`, () => {
expect.hasAssertions();
const jsonVectors = toArray(read(jsonData));
const binaryVectors = toArray(read(arrowBuffers));
for (const [jVectors, bVectors] of zip(jsonVectors, binaryVectors)) {
expect(jVectors.length).toEqual(bVectors.length);
for (let i = -1, n = jVectors.length; ++i < n;) {
(expect(jVectors[i]) as any).toEqualVector(bVectors[i]);
}
}
});
示例2: test
test(`json and arrow record batches report the same values`, () => {
expect.hasAssertions();
const jsonRecordBatches = toArray(read(jsonData));
const binaryRecordBatches = toArray(read(arrowBuffer));
for (const [jsonRecordBatch, binaryRecordBatch] of zip(jsonRecordBatches, binaryRecordBatches)) {
expect(jsonRecordBatch.length).toEqual(binaryRecordBatch.length);
expect(jsonRecordBatch.numCols).toEqual(binaryRecordBatch.numCols);
for (let i = -1, n = jsonRecordBatch.numCols; ++i < n;) {
(jsonRecordBatch.getChildAt(i) as any).name = jsonRecordBatch.schema.fields[i].name;
(expect(jsonRecordBatch.getChildAt(i)) as any).toEqualVector(binaryRecordBatch.getChildAt(i));
}
}
});
示例3: getFileBuffer
.map((p) => path.resolve(p))
.map((p) => {
if (fs.existsSync(p)) {
return p;
}
console.error(`Could not find file "${p}"`);
return undefined;
});
}
const getOrReadFileBuffer = ((cache: any) => function getFileBuffer(path: string, ...args: any[]) {
return cache[path] || (cache[path] = fs.readFileSync(path, ...args));
})({});
const jsonAndArrowPaths = toArray(zip(
resolvePathArgs(process.env.JSON_PATHS!),
resolvePathArgs(process.env.ARROW_PATHS!)
))
.filter(([p1, p2]) => p1 !== undefined && p2 !== undefined) as [string, string][];
expect.extend({
toEqualVector([v1, format1, columnName]: [any, string, string], [v2, format2]: [any, string]) {
const format = (x: any, y: any, msg= ' ') => `${
this.utils.printExpected(x)}${
msg}${
this.utils.printReceived(y)
}`;
let getFailures = new Array<string>();
let propsFailures = new Array<string>();
let iteratorFailures = new Array<string>();