當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript toArray.toArray函數代碼示例

本文整理匯總了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]);
         }
     }
 });
開發者ID:giantwhale,項目名稱:arrow,代碼行數:11,代碼來源:validate-tests.ts

示例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));
         }
     }
 });
開發者ID:sunchao,項目名稱:arrow,代碼行數:13,代碼來源:validate-tests.ts

示例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>();
開發者ID:CodingCat,項目名稱:arrow,代碼行數:32,代碼來源:validate-tests.ts


注:本文中的ix/iterable/toArray.toArray函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。