Skip to content

Commit f9dd97b

Browse files
author
Léo Guillaume
committed
feat: xtable
1 parent 0042ca7 commit f9dd97b

File tree

4 files changed

+59
-3
lines changed

4 files changed

+59
-3
lines changed

src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@
2222
*/
2323

2424
import { Language } from './language';
25-
import { NlpUtil, NlpManager } from './nlp';
25+
import { NlpUtil, NlpManager, NlpExcelReader } from './nlp';
26+
import { XTableUtils, XTable, XDoc } from './xtables';
2627

2728
export {
2829
Language,
2930
NlpUtil,
30-
NlpManager
31+
NlpManager,
32+
NlpExcelReader,
33+
XTableUtils,
34+
XTable,
35+
XDoc,
3136
};

src/nlp/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323

2424
import NlpUtil from './nlp-util';
2525
import NlpManager from './nlp-manager';
26+
import NlpExcelReader from './nlp-excel-reader';
2627

2728
export {
2829
NlpUtil,
29-
NlpManager
30+
NlpManager,
31+
NlpExcelReader
3032
}

src/types/@nlpjs/xtables.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ declare module '@nlpjs/xtables' {
55
data: Record<string, string>[];
66
}
77

8+
export class XTableUtils {
9+
static escapeCsv(value: string): string;
10+
static escapeTsv(value: string): string;
11+
}
12+
13+
export class XTable {
14+
static CSV: string;
15+
static TSV: string;
16+
17+
constructor();
18+
load(data: string, type?: string): void;
19+
save(type?: string): string;
20+
getTable(name: string): XTable;
21+
getRows(): Record<string, string>[];
22+
addRow(row: Record<string, string>): void;
23+
addRows(rows: Record<string, string>[]): void;
24+
clearRows(): void;
25+
}
26+
827
export class XDoc {
928
tables: XDocTable[];
1029

src/xtables/index.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) AXA Group Operations Spain S.A.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining
5+
* a copy of this software and associated documentation files (the
6+
* "Software"), to deal in the Software without restriction, including
7+
* without limitation the rights to use, copy, modify, merge, publish,
8+
* distribute, sublicense, and/or sell copies of the Software, and to
9+
* permit persons to whom the Software is furnished to do so, subject to
10+
* the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be
13+
* included in all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
*/
23+
24+
import { XTableUtils, XTable, XDoc } from '@nlpjs/xtables';
25+
26+
export {
27+
XTableUtils,
28+
XTable,
29+
XDoc,
30+
};

0 commit comments

Comments
 (0)