本文整理匯總了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>();