gff-nostream 1.3.1 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +10 -22
- package/dist/api.js +14 -23
- package/dist/api.js.map +1 -1
- package/esm/api.d.ts +10 -22
- package/esm/api.js +14 -31
- package/esm/api.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +17 -65
package/dist/api.d.ts
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
parseDirectives?: boolean;
|
|
12
|
-
/** Whether to parse comments, default false */
|
|
13
|
-
parseComments?: boolean;
|
|
14
|
-
/** Whether to parse sequences, default true */
|
|
15
|
-
parseSequences?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Parse all features, directives, comments, and sequences. Overrides other
|
|
18
|
-
* parsing options. Default false.
|
|
19
|
-
*/
|
|
20
|
-
parseAll?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export declare function parseStringSync(str: string, inputOptions?: ParseOptions): GFF3Item[];
|
|
1
|
+
import { GFF3Feature } from './util';
|
|
2
|
+
/**
|
|
3
|
+
* Synchronously parse a string containing GFF3 and return an array of the
|
|
4
|
+
* parsed items.
|
|
5
|
+
*
|
|
6
|
+
* @param str - GFF3 string
|
|
7
|
+
* @param inputOptions - Parsing options
|
|
8
|
+
* @returns array of parsed features, directives, comments and/or sequences
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseStringSync(str: string): GFF3Feature[];
|
|
23
11
|
export { type GFF3FeatureLine, type GFF3Comment, type GFF3FeatureLineWithRefs, type GFF3Directive, type GFF3Sequence, type GFF3Feature, type GFF3Item, } from './util';
|
package/dist/api.js
CHANGED
|
@@ -5,35 +5,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.parseStringSync = parseStringSync;
|
|
7
7
|
const parse_1 = __importDefault(require("./parse"));
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return out;
|
|
18
|
-
}
|
|
19
|
-
function parseStringSync(str, inputOptions = {}) {
|
|
20
|
-
if (!str) {
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
const options = _processParseOptions(inputOptions);
|
|
8
|
+
/**
|
|
9
|
+
* Synchronously parse a string containing GFF3 and return an array of the
|
|
10
|
+
* parsed items.
|
|
11
|
+
*
|
|
12
|
+
* @param str - GFF3 string
|
|
13
|
+
* @param inputOptions - Parsing options
|
|
14
|
+
* @returns array of parsed features, directives, comments and/or sequences
|
|
15
|
+
*/
|
|
16
|
+
function parseStringSync(str) {
|
|
24
17
|
const items = [];
|
|
25
|
-
const push = items.push.bind(items);
|
|
26
18
|
const parser = new parse_1.default({
|
|
27
|
-
featureCallback:
|
|
28
|
-
|
|
29
|
-
commentCallback: options.parseComments ? push : undefined,
|
|
30
|
-
sequenceCallback: options.parseSequences ? push : undefined,
|
|
31
|
-
disableDerivesFromReferences: options.disableDerivesFromReferences || false,
|
|
19
|
+
featureCallback: arg => items.push(arg),
|
|
20
|
+
disableDerivesFromReferences: true,
|
|
32
21
|
errorCallback: err => {
|
|
33
22
|
throw err;
|
|
34
23
|
},
|
|
35
24
|
});
|
|
36
|
-
str.split(/\r?\n/)
|
|
25
|
+
for (const line of str.split(/\r?\n/)) {
|
|
26
|
+
parser.addLine(line);
|
|
27
|
+
}
|
|
37
28
|
parser.finish();
|
|
38
29
|
return items;
|
|
39
30
|
}
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";;;;;AAWA,0CAgBC;AA3BD,oDAA4B;AAG5B;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,MAAM,KAAK,GAAkB,EAAE,CAAA;IAC/B,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC;QACxB,eAAe,EAAE,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;QACvC,4BAA4B,EAAE,IAAI;QAClC,aAAa,EAAE,GAAG,CAAC,EAAE;YACnB,MAAM,GAAG,CAAA;QACX,CAAC;KACF,CAAC,CAAA;IAEF,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IACD,MAAM,CAAC,MAAM,EAAE,CAAA;IAEf,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/esm/api.d.ts
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
parseDirectives?: boolean;
|
|
12
|
-
/** Whether to parse comments, default false */
|
|
13
|
-
parseComments?: boolean;
|
|
14
|
-
/** Whether to parse sequences, default true */
|
|
15
|
-
parseSequences?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Parse all features, directives, comments, and sequences. Overrides other
|
|
18
|
-
* parsing options. Default false.
|
|
19
|
-
*/
|
|
20
|
-
parseAll?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export declare function parseStringSync(str: string, inputOptions?: ParseOptions): GFF3Item[];
|
|
1
|
+
import { GFF3Feature } from './util';
|
|
2
|
+
/**
|
|
3
|
+
* Synchronously parse a string containing GFF3 and return an array of the
|
|
4
|
+
* parsed items.
|
|
5
|
+
*
|
|
6
|
+
* @param str - GFF3 string
|
|
7
|
+
* @param inputOptions - Parsing options
|
|
8
|
+
* @returns array of parsed features, directives, comments and/or sequences
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseStringSync(str: string): GFF3Feature[];
|
|
23
11
|
export { type GFF3FeatureLine, type GFF3Comment, type GFF3FeatureLineWithRefs, type GFF3Directive, type GFF3Sequence, type GFF3Feature, type GFF3Item, } from './util';
|
package/esm/api.js
CHANGED
|
@@ -1,41 +1,24 @@
|
|
|
1
1
|
import Parser from './parse';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
...options,
|
|
12
|
-
};
|
|
13
|
-
if (options.parseAll) {
|
|
14
|
-
out.parseFeatures = true;
|
|
15
|
-
out.parseDirectives = true;
|
|
16
|
-
out.parseComments = true;
|
|
17
|
-
out.parseSequences = true;
|
|
18
|
-
}
|
|
19
|
-
return out;
|
|
20
|
-
}
|
|
21
|
-
export function parseStringSync(str, inputOptions = {}) {
|
|
22
|
-
if (!str) {
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
const options = _processParseOptions(inputOptions);
|
|
2
|
+
/**
|
|
3
|
+
* Synchronously parse a string containing GFF3 and return an array of the
|
|
4
|
+
* parsed items.
|
|
5
|
+
*
|
|
6
|
+
* @param str - GFF3 string
|
|
7
|
+
* @param inputOptions - Parsing options
|
|
8
|
+
* @returns array of parsed features, directives, comments and/or sequences
|
|
9
|
+
*/
|
|
10
|
+
export function parseStringSync(str) {
|
|
26
11
|
const items = [];
|
|
27
|
-
const push = items.push.bind(items);
|
|
28
12
|
const parser = new Parser({
|
|
29
|
-
featureCallback:
|
|
30
|
-
|
|
31
|
-
commentCallback: options.parseComments ? push : undefined,
|
|
32
|
-
sequenceCallback: options.parseSequences ? push : undefined,
|
|
33
|
-
disableDerivesFromReferences: options.disableDerivesFromReferences || false,
|
|
13
|
+
featureCallback: arg => items.push(arg),
|
|
14
|
+
disableDerivesFromReferences: true,
|
|
34
15
|
errorCallback: err => {
|
|
35
16
|
throw err;
|
|
36
17
|
},
|
|
37
18
|
});
|
|
38
|
-
str.split(/\r?\n/)
|
|
19
|
+
for (const line of str.split(/\r?\n/)) {
|
|
20
|
+
parser.addLine(line);
|
|
21
|
+
}
|
|
39
22
|
parser.finish();
|
|
40
23
|
return items;
|
|
41
24
|
}
|
package/esm/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAG5B;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,MAAM,KAAK,GAAkB,EAAE,CAAA;IAC/B,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACxB,eAAe,EAAE,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;QACvC,4BAA4B,EAAE,IAAI;QAClC,aAAa,EAAE,GAAG,CAAC,EAAE;YACnB,MAAM,GAAG,CAAA;QACX,CAAC;KACF,CAAC,CAAA;IAEF,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IACD,MAAM,CAAC,MAAM,EAAE,CAAA;IAEf,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -1,75 +1,27 @@
|
|
|
1
1
|
import Parser from './parse'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/** Whether to parse comments, default false */
|
|
15
|
-
parseComments?: boolean
|
|
16
|
-
/** Whether to parse sequences, default true */
|
|
17
|
-
parseSequences?: boolean
|
|
18
|
-
/**
|
|
19
|
-
* Parse all features, directives, comments, and sequences. Overrides other
|
|
20
|
-
* parsing options. Default false.
|
|
21
|
-
*/
|
|
22
|
-
parseAll?: boolean
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type ParseOptionsProcessed = Required<Omit<ParseOptions, 'parseAll'>>
|
|
26
|
-
|
|
27
|
-
// shared arg processing for the parse routines
|
|
28
|
-
function _processParseOptions(options: ParseOptions): ParseOptionsProcessed {
|
|
29
|
-
const out = {
|
|
30
|
-
encoding: 'utf8' as const,
|
|
31
|
-
parseFeatures: true,
|
|
32
|
-
parseDirectives: false,
|
|
33
|
-
parseSequences: true,
|
|
34
|
-
parseComments: false,
|
|
35
|
-
disableDerivesFromReferences: false,
|
|
36
|
-
...options,
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (options.parseAll) {
|
|
40
|
-
out.parseFeatures = true
|
|
41
|
-
out.parseDirectives = true
|
|
42
|
-
out.parseComments = true
|
|
43
|
-
out.parseSequences = true
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return out
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function parseStringSync(
|
|
50
|
-
str: string,
|
|
51
|
-
inputOptions: ParseOptions = {},
|
|
52
|
-
): GFF3Item[] {
|
|
53
|
-
if (!str) {
|
|
54
|
-
return []
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const options = _processParseOptions(inputOptions)
|
|
58
|
-
const items: GFF3Item[] = []
|
|
59
|
-
const push = items.push.bind(items)
|
|
60
|
-
|
|
2
|
+
import { GFF3Feature } from './util'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Synchronously parse a string containing GFF3 and return an array of the
|
|
6
|
+
* parsed items.
|
|
7
|
+
*
|
|
8
|
+
* @param str - GFF3 string
|
|
9
|
+
* @param inputOptions - Parsing options
|
|
10
|
+
* @returns array of parsed features, directives, comments and/or sequences
|
|
11
|
+
*/
|
|
12
|
+
export function parseStringSync(str: string): GFF3Feature[] {
|
|
13
|
+
const items: GFF3Feature[] = []
|
|
61
14
|
const parser = new Parser({
|
|
62
|
-
featureCallback:
|
|
63
|
-
|
|
64
|
-
commentCallback: options.parseComments ? push : undefined,
|
|
65
|
-
sequenceCallback: options.parseSequences ? push : undefined,
|
|
66
|
-
disableDerivesFromReferences: options.disableDerivesFromReferences || false,
|
|
15
|
+
featureCallback: arg => items.push(arg),
|
|
16
|
+
disableDerivesFromReferences: true,
|
|
67
17
|
errorCallback: err => {
|
|
68
18
|
throw err
|
|
69
19
|
},
|
|
70
20
|
})
|
|
71
21
|
|
|
72
|
-
str.split(/\r?\n/)
|
|
22
|
+
for (const line of str.split(/\r?\n/)) {
|
|
23
|
+
parser.addLine(line)
|
|
24
|
+
}
|
|
73
25
|
parser.finish()
|
|
74
26
|
|
|
75
27
|
return items
|