本文整理匯總了TypeScript中@jupyterlab/csvviewer.parseDSVNoQuotes函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript parseDSVNoQuotes函數的具體用法?TypeScript parseDSVNoQuotes怎麽用?TypeScript parseDSVNoQuotes使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了parseDSVNoQuotes函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('handles changing the field delimiter', () => {
const data = `a\tb\tc\td\n0\t1\t2\t3\n4\t5\t6\t7\n`;
const options = { data, delimiter: '\t', rowDelimiter: '\n' };
let results;
results = parser({ ...options, columnOffsets: false });
expect(results.nrows).to.deep.equal(3);
expect(results.offsets).to.deep.equal([0, 8, 16]);
results = parser({ ...options, columnOffsets: true });
expect(results.nrows).to.deep.equal(3);
expect(results.ncols).to.deep.equal(4);
expect(results.offsets).to.deep.equal([
0,
2,
4,
6,
8,
10,
12,
14,
16,
18,
20,
22
]);
});
示例2: it
it('adjusts columns to match ncols', () => {
let data = `a,b,c,d\n0,\n1,2,3,4,5,6`;
let options = { data, rowDelimiter: '\n', ncols: 5 };
let results;
results = parser({ ...options, columnOffsets: false });
expect(results.nrows).to.eql(3);
expect(results.offsets).to.eql([0, 8, 11]);
results = parser({ ...options, columnOffsets: true });
expect(results.nrows).to.eql(3);
expect(results.ncols).to.eql(5);
expect(results.offsets).to.eql([
0,
2,
4,
6,
7,
8,
10,
10,
10,
10,
11,
13,
15,
17,
19
]);
});