gff-nostream 1.3.1 → 1.3.3
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 -2
- package/dist/api.js +14 -23
- package/dist/api.js.map +1 -1
- package/esm/api.d.ts +10 -2
- package/esm/api.js +14 -31
- package/esm/api.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +23 -41
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GFF3Feature } from './util';
|
|
2
2
|
/** Parser options */
|
|
3
3
|
export interface ParseOptions {
|
|
4
4
|
/** Whether to resolve references to derives from features */
|
|
@@ -19,5 +19,13 @@ export interface ParseOptions {
|
|
|
19
19
|
*/
|
|
20
20
|
parseAll?: boolean;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Synchronously parse a string containing GFF3 and return an array of the
|
|
24
|
+
* parsed items.
|
|
25
|
+
*
|
|
26
|
+
* @param str - GFF3 string
|
|
27
|
+
* @param inputOptions - Parsing options
|
|
28
|
+
* @returns array of parsed features, directives, comments and/or sequences
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseStringSync(str: string): GFF3Feature[];
|
|
23
31
|
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":";;;;;AAyCA,0CAgBC;AAzDD,oDAA4B;AAiC5B;;;;;;;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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GFF3Feature } from './util';
|
|
2
2
|
/** Parser options */
|
|
3
3
|
export interface ParseOptions {
|
|
4
4
|
/** Whether to resolve references to derives from features */
|
|
@@ -19,5 +19,13 @@ export interface ParseOptions {
|
|
|
19
19
|
*/
|
|
20
20
|
parseAll?: boolean;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Synchronously parse a string containing GFF3 and return an array of the
|
|
24
|
+
* parsed items.
|
|
25
|
+
*
|
|
26
|
+
* @param str - GFF3 string
|
|
27
|
+
* @param inputOptions - Parsing options
|
|
28
|
+
* @returns array of parsed features, directives, comments and/or sequences
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseStringSync(str: string): GFF3Feature[];
|
|
23
31
|
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;AAiC5B;;;;;;;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,5 +1,12 @@
|
|
|
1
1
|
import Parser from './parse'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
GFF3Comment,
|
|
4
|
+
GFF3Directive,
|
|
5
|
+
GFF3Feature,
|
|
6
|
+
GFF3Item,
|
|
7
|
+
GFF3Sequence,
|
|
8
|
+
parseFeature,
|
|
9
|
+
} from './util'
|
|
3
10
|
|
|
4
11
|
/** Parser options */
|
|
5
12
|
export interface ParseOptions {
|
|
@@ -24,52 +31,27 @@ export interface ParseOptions {
|
|
|
24
31
|
|
|
25
32
|
type ParseOptionsProcessed = Required<Omit<ParseOptions, 'parseAll'>>
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Synchronously parse a string containing GFF3 and return an array of the
|
|
36
|
+
* parsed items.
|
|
37
|
+
*
|
|
38
|
+
* @param str - GFF3 string
|
|
39
|
+
* @param inputOptions - Parsing options
|
|
40
|
+
* @returns array of parsed features, directives, comments and/or sequences
|
|
41
|
+
*/
|
|
42
|
+
export function parseStringSync(str: string): GFF3Feature[] {
|
|
43
|
+
const items: GFF3Feature[] = []
|
|
61
44
|
const parser = new Parser({
|
|
62
|
-
featureCallback:
|
|
63
|
-
|
|
64
|
-
commentCallback: options.parseComments ? push : undefined,
|
|
65
|
-
sequenceCallback: options.parseSequences ? push : undefined,
|
|
66
|
-
disableDerivesFromReferences: options.disableDerivesFromReferences || false,
|
|
45
|
+
featureCallback: arg => items.push(arg),
|
|
46
|
+
disableDerivesFromReferences: true,
|
|
67
47
|
errorCallback: err => {
|
|
68
48
|
throw err
|
|
69
49
|
},
|
|
70
50
|
})
|
|
71
51
|
|
|
72
|
-
str.split(/\r?\n/)
|
|
52
|
+
for (const line of str.split(/\r?\n/)) {
|
|
53
|
+
parser.addLine(line)
|
|
54
|
+
}
|
|
73
55
|
parser.finish()
|
|
74
56
|
|
|
75
57
|
return items
|