@aidc-toolkit/gs1 1.0.46-beta → 1.0.47-beta
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/abstract-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/abstract-numeric-identifier-creator.js +3 -5
- package/dist/abstract-numeric-identifier-creator.js.map +1 -1
- package/dist/gtin-creator.d.ts +23 -10
- package/dist/gtin-creator.d.ts.map +1 -1
- package/dist/gtin-creator.js +3 -21
- package/dist/gtin-creator.js.map +1 -1
- package/dist/non-numeric-identifier-creator.d.ts +15 -8
- package/dist/non-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/non-numeric-identifier-creator.js +4 -22
- package/dist/non-numeric-identifier-creator.js.map +1 -1
- package/dist/numeric-identifier-creator.d.ts +30 -18
- package/dist/numeric-identifier-creator.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-creator.d.ts +38 -15
- package/dist/serializable-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-creator.js +6 -59
- package/dist/serializable-numeric-identifier-creator.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/src/abstract-numeric-identifier-creator.ts +11 -9
- package/src/gtin-creator.ts +29 -17
- package/src/non-numeric-identifier-creator.ts +21 -23
- package/src/numeric-identifier-creator.ts +32 -18
- package/src/serializable-numeric-identifier-creator.ts +70 -32
- package/src/version.ts +1 -1
- package/tsconfig-src.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/abstract-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"abstract-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/abstract-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,oCAAoC,EAAE,MAAM,4BAA4B,CAAC;AAEhH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EAA+B,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACjH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,MAAM,mCAAmC,CAC3C,sBAAsB,SAAS,qBAAqB,EACpD,2BAA2B,SAAS,0BAA0B,CAAC,sBAAsB,CAAC,IACtF,mBAAmB,CACnB;IAAC,cAAc,EAAE,cAAc;IAAE,MAAM,EAAE,MAAM;IAAE,GAAG,IAAI,EAAE,qBAAqB,CAAC,oCAAoC,CAAC,sBAAsB,CAAC,CAAC;CAAC,EAC9I,2BAA2B,GAAG,wBAAwB,CAAC,sBAAsB,CAAC,CACjF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,qCAAqC,CACjD,sBAAsB,SAAS,qBAAqB,EACtD,qCAAqC,EAAE,mBAAmB,CACxD,qBAAqB,CAAC,oCAAoC,CAAC,sBAAsB,CAAC,CAAC,EACnF,uBAAuB,CAAC,sBAAsB,CAAC,CAClD,GAAG,mCAAmC,CACnC,sBAAsB,EACtB,uBAAuB,CAAC,sBAAsB,CAAC,CAClD,CA6KA"}
|
|
@@ -76,11 +76,9 @@ export function MixinAbstractNumericIdentifierCreator(NumericIdentifierValidator
|
|
|
76
76
|
const partialIdentifier = this.leaderType === LeaderTypes.ExtensionDigit ? reference.substring(0, 1) + this.prefix + reference.substring(1) : this.prefix + reference;
|
|
77
77
|
return partialIdentifier + checkDigit(partialIdentifier);
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
create(valueOrValues, sparse = false) {
|
|
83
|
-
return NUMERIC_CREATOR.create(this.referenceLength, valueOrValues, Exclusions.None, sparse ? this.tweak : undefined, reference => this.#buildIdentifier(reference));
|
|
79
|
+
// eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
|
|
80
|
+
create(valueOrValues, sparse) {
|
|
81
|
+
return NUMERIC_CREATOR.create(this.referenceLength, valueOrValues, Exclusions.None, sparse === true ? this.tweak : undefined, reference => this.#buildIdentifier(reference));
|
|
84
82
|
}
|
|
85
83
|
/**
|
|
86
84
|
* Create all identifiers from a partial identifier. Call is recursive until remaining reference
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/abstract-numeric-identifier-creator.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"abstract-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/abstract-numeric-identifier-creator.ts"],"names":[],"mappings":"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"}
|
package/dist/gtin-creator.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type TransformerInput, type TransformerOutput } from "@aidc-toolkit/utility";
|
|
2
1
|
import { type GTINBaseLength } from "./gtin-length.js";
|
|
3
2
|
import { GTINValidator } from "./gtin-validator.js";
|
|
4
3
|
import type { PrefixProvider } from "./prefix-provider.js";
|
|
@@ -23,25 +22,39 @@ export declare class GTINCreator extends GTINCreator_base {
|
|
|
23
22
|
*/
|
|
24
23
|
get prefix(): string;
|
|
25
24
|
/**
|
|
26
|
-
* Create GTIN-14
|
|
27
|
-
*
|
|
25
|
+
* Create GTIN-14 with an indicator digit and reference based on a numeric value. The value is converted to a
|
|
26
|
+
* reference of the appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
28
27
|
*
|
|
29
|
-
* @
|
|
30
|
-
*
|
|
28
|
+
* @param indicatorDigit
|
|
29
|
+
* Indicator digit.
|
|
30
|
+
*
|
|
31
|
+
* @param value
|
|
32
|
+
* Numeric value.
|
|
33
|
+
*
|
|
34
|
+
* @param sparse
|
|
35
|
+
* If true, the value is mapped to a sparse sequence resistant to discovery.
|
|
36
|
+
*
|
|
37
|
+
* @returns
|
|
38
|
+
* GTIN-14.
|
|
39
|
+
*/
|
|
40
|
+
createGTIN14(indicatorDigit: string, value: number | bigint, sparse?: boolean): string;
|
|
41
|
+
/**
|
|
42
|
+
* Create GTIN-14s with an indicator digit and references based on numeric values. The values are converted to
|
|
43
|
+
* references of the appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
31
44
|
*
|
|
32
45
|
* @param indicatorDigit
|
|
33
46
|
* Indicator digit.
|
|
34
47
|
*
|
|
35
|
-
* @param
|
|
36
|
-
* Numeric
|
|
48
|
+
* @param values
|
|
49
|
+
* Numeric values.
|
|
37
50
|
*
|
|
38
51
|
* @param sparse
|
|
39
|
-
* If true, the
|
|
52
|
+
* If true, the values are mapped to a sparse sequence resistant to discovery.
|
|
40
53
|
*
|
|
41
54
|
* @returns
|
|
42
|
-
* GTIN-
|
|
55
|
+
* GTIN-14s.
|
|
43
56
|
*/
|
|
44
|
-
createGTIN14
|
|
57
|
+
createGTIN14(indicatorDigit: string, values: Iterable<number | bigint>, sparse?: boolean): Iterable<string>;
|
|
45
58
|
}
|
|
46
59
|
export {};
|
|
47
60
|
//# sourceMappingURL=gtin-creator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gtin-creator.d.ts","sourceRoot":"","sources":["../src/gtin-creator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gtin-creator.d.ts","sourceRoot":"","sources":["../src/gtin-creator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;;AAE3D;;GAEG;AACH,qBAAa,WAAY,SAAQ,gBAEjB;;IAUZ;;;;;;;;OAQG;gBACS,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc;IAI1E;;OAEG;IACH,IAAa,MAAM,IAAI,MAAM,CAE5B;IAED;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM;IAEtF;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC;CAY9G"}
|
package/dist/gtin-creator.js
CHANGED
|
@@ -34,28 +34,10 @@ export class GTINCreator extends MixinAbstractNumericIdentifierCreator(GTINValid
|
|
|
34
34
|
get prefix() {
|
|
35
35
|
return this.prefixProvider.prefix;
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
* converted to reference(s) of the appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
40
|
-
*
|
|
41
|
-
* @template TTransformerInput
|
|
42
|
-
* Transformer input type.
|
|
43
|
-
*
|
|
44
|
-
* @param indicatorDigit
|
|
45
|
-
* Indicator digit.
|
|
46
|
-
*
|
|
47
|
-
* @param valueOrValues
|
|
48
|
-
* Numeric value(s).
|
|
49
|
-
*
|
|
50
|
-
* @param sparse
|
|
51
|
-
* If true, the value(s) is/are mapped to a sparse sequence resistant to discovery. Default is false.
|
|
52
|
-
*
|
|
53
|
-
* @returns
|
|
54
|
-
* GTIN-14(s).
|
|
55
|
-
*/
|
|
56
|
-
createGTIN14(indicatorDigit, valueOrValues, sparse = false) {
|
|
37
|
+
// eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
|
|
38
|
+
createGTIN14(indicatorDigit, valueOrValues, sparse) {
|
|
57
39
|
NUMERIC_CREATOR.validate(indicatorDigit, GTINCreator.#REQUIRED_INDICATOR_DIGIT_VALIDATION);
|
|
58
|
-
return NUMERIC_CREATOR.create(GTINLengths.GTIN13 - this.prefixProvider.gs1CompanyPrefix.length - 1, valueOrValues, Exclusions.None, sparse ? this.tweak : undefined, (reference) => {
|
|
40
|
+
return NUMERIC_CREATOR.create(GTINLengths.GTIN13 - this.prefixProvider.gs1CompanyPrefix.length - 1, valueOrValues, Exclusions.None, sparse === true ? this.tweak : undefined, (reference) => {
|
|
59
41
|
const partialIdentifier = indicatorDigit + this.prefixProvider.gs1CompanyPrefix + reference;
|
|
60
42
|
return partialIdentifier + checkDigit(partialIdentifier);
|
|
61
43
|
});
|
package/dist/gtin-creator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gtin-creator.js","sourceRoot":"","sources":["../src/gtin-creator.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"gtin-creator.js","sourceRoot":"","sources":["../src/gtin-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,qCAAqC,EAAE,MAAM,0CAA0C,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAuB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,qCAAqC,CAEpE,aAAa,CAAC;IACZ;;OAEG;IACH,MAAM,CAAU,oCAAoC,GAA2B;QAC3E,aAAa,EAAE,CAAC;QAChB,aAAa,EAAE,CAAC;QAChB,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,2BAA2B,CAAC;KAC7D,CAAC;IAEF;;;;;;;;OAQG;IACH,YAAY,cAA8B,EAAE,cAA8B;QACtE,KAAK,CAAC,cAAc,EAAE,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,IAAa,MAAM;QACf,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;IACtC,CAAC;IAsCD,2FAA2F;IAC3F,YAAY,CAAC,cAAsB,EAAE,aAA0D,EAAE,MAAgB;QAC7G,eAAe,CAAC,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,oCAAoC,CAAC,CAAC;QAE3F,OAAO,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,aAAa,EAAE,UAAU,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;YACxL,MAAM,iBAAiB,GAAG,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,GAAG,SAAS,CAAC;YAE5F,OAAO,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACP,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CharacterSetValidation
|
|
1
|
+
import { type CharacterSetValidation } from "@aidc-toolkit/utility";
|
|
2
2
|
import type { NonNumericIdentifierType } from "./non-numeric-identifier-type.js";
|
|
3
3
|
import { type NonNumericIdentifierValidation, NonNumericIdentifierValidator } from "./non-numeric-identifier-validator.js";
|
|
4
4
|
import type { PrefixProvider } from "./prefix-provider.js";
|
|
@@ -23,18 +23,25 @@ export declare class NonNumericIdentifierCreator extends NonNumericIdentifierCre
|
|
|
23
23
|
*/
|
|
24
24
|
protected get referenceValidation(): CharacterSetValidation;
|
|
25
25
|
/**
|
|
26
|
-
* Create identifier
|
|
26
|
+
* Create an identifier with a reference.
|
|
27
27
|
*
|
|
28
|
-
* @
|
|
29
|
-
*
|
|
28
|
+
* @param reference
|
|
29
|
+
* Reference.
|
|
30
30
|
*
|
|
31
|
-
* @
|
|
32
|
-
*
|
|
31
|
+
* @returns
|
|
32
|
+
* Identifier.
|
|
33
|
+
*/
|
|
34
|
+
create(reference: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Create identifiers with references.
|
|
37
|
+
*
|
|
38
|
+
* @param references
|
|
39
|
+
* References.
|
|
33
40
|
*
|
|
34
41
|
* @returns
|
|
35
|
-
*
|
|
42
|
+
* Identifiers.
|
|
36
43
|
*/
|
|
37
|
-
create
|
|
44
|
+
create(references: Iterable<string>): Iterable<string>;
|
|
38
45
|
}
|
|
39
46
|
export {};
|
|
40
47
|
//# sourceMappingURL=non-numeric-identifier-creator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/non-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"non-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/non-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAe,MAAM,uBAAuB,CAAC;AAKjF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EACH,KAAK,8BAA8B,EACnC,6BAA6B,EAChC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;;AAE3D;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,gCAGjB;;IAM5B;;;;;;;;OAQG;gBACS,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,wBAAwB;IAWpF;;OAEG;IACH,SAAS,KAAK,mBAAmB,IAAI,sBAAsB,CAE1D;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAEjC;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC;CA8BzD"}
|
|
@@ -36,21 +36,8 @@ export class NonNumericIdentifierCreator extends MixinAbstractIdentifierCreator(
|
|
|
36
36
|
get referenceValidation() {
|
|
37
37
|
return this.#referenceValidation;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
* Create identifier(s) with reference(s).
|
|
41
|
-
*
|
|
42
|
-
* @template TTransformerInput
|
|
43
|
-
* Transformer input type.
|
|
44
|
-
*
|
|
45
|
-
* @param referenceOrReferences
|
|
46
|
-
* Reference(s).
|
|
47
|
-
*
|
|
48
|
-
* @returns
|
|
49
|
-
* Identifier(s).
|
|
50
|
-
*/
|
|
39
|
+
// eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
|
|
51
40
|
create(referenceOrReferences) {
|
|
52
|
-
// TODO Refactor type when https://github.com/microsoft/TypeScript/pull/56941 released.
|
|
53
|
-
let result;
|
|
54
41
|
const referenceCreator = this.referenceCreator;
|
|
55
42
|
const referenceValidation = this.referenceValidation;
|
|
56
43
|
const prefix = this.prefix;
|
|
@@ -69,14 +56,9 @@ export class NonNumericIdentifierCreator extends MixinAbstractIdentifierCreator(
|
|
|
69
56
|
const partialIdentifier = prefix + reference;
|
|
70
57
|
return requiresCheckCharacterPair ? partialIdentifier + checkCharacterPair(partialIdentifier) : partialIdentifier;
|
|
71
58
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
else {
|
|
76
|
-
result = mapIterable(referenceOrReferences, validateAndCreate);
|
|
77
|
-
}
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type determination is handled above.
|
|
79
|
-
return result;
|
|
59
|
+
return typeof referenceOrReferences !== "object" ?
|
|
60
|
+
validateAndCreate(referenceOrReferences) :
|
|
61
|
+
mapIterable(referenceOrReferences, validateAndCreate);
|
|
80
62
|
}
|
|
81
63
|
}
|
|
82
64
|
//# sourceMappingURL=non-numeric-identifier-creator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/non-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"non-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/non-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAEH,6BAA6B,EAChC,MAAM,uCAAuC,CAAC;AAG/C;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,8BAA8B,CAG7E,6BAA6B,CAAC;IAC5B;;OAEG;IACM,oBAAoB,CAAyB;IAEtD;;;;;;;;OAQG;IACH,YAAY,cAA8B,EAAE,cAAwC;QAChF,KAAK,CAAC,cAAc,EAAE,cAAc,CAAC,gBAAgB,EAAE,CAAC,GAAG,MAAM,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC,0BAA0B,CAAC,EAAE,cAAc,CAAC,CAAC;QAErJ,IAAI,CAAC,oBAAoB,GAAG;YACxB,aAAa,EAAE,CAAC;YAChB,+EAA+E;YAC/E,aAAa,EAAE,IAAI,CAAC,eAAe;YACnC,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,sBAAsB,CAAC;SACxD,CAAC;IACN,CAAC;IAED;;OAEG;IACH,IAAc,mBAAmB;QAC7B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAwBD,2FAA2F;IAC3F,MAAM,CAAC,qBAAgD;QACnD,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC/C,MAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACrD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,0BAA0B,GAAG,IAAI,CAAC,0BAA0B,CAAC;QAEnE;;;;;;;;WAQG;QACH,SAAS,iBAAiB,CAAC,SAAiB;YACxC,gBAAgB,CAAC,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;YAE1D,MAAM,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAAC;YAE7C,OAAO,0BAA0B,CAAC,CAAC,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC;QACtH,CAAC;QAED,OAAO,OAAO,qBAAqB,KAAK,QAAQ,CAAC,CAAC;YAC9C,iBAAiB,CAAC,qBAAqB,CAAC,CAAC,CAAC;YAC1C,WAAW,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;IAC9D,CAAC;CACJ"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type TransformerInput, type TransformerOutput } from "@aidc-toolkit/utility";
|
|
2
1
|
import type { IdentifierCreator } from "./identifier-creator.js";
|
|
3
2
|
import type { NumericIdentifierType } from "./numeric-identifier-type.js";
|
|
4
3
|
import type { NumericIdentifierValidation, NumericIdentifierValidator } from "./numeric-identifier-validator.js";
|
|
@@ -21,23 +20,36 @@ export interface NumericIdentifierCreator<TNumericIdentifierType extends Numeric
|
|
|
21
20
|
* Set the tweak for sparse creation.
|
|
22
21
|
*/
|
|
23
22
|
set tweak(value: bigint);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
create: {
|
|
24
|
+
/**
|
|
25
|
+
* Create an identifier with a reference based on a numeric value. The value is converted to a reference of the
|
|
26
|
+
* appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
27
|
+
*
|
|
28
|
+
* @param value
|
|
29
|
+
* Numeric value.
|
|
30
|
+
*
|
|
31
|
+
* @param sparse
|
|
32
|
+
* If true, the value is mapped to a sparse sequence resistant to discovery.
|
|
33
|
+
*
|
|
34
|
+
* @returns
|
|
35
|
+
* Identifier.
|
|
36
|
+
*/
|
|
37
|
+
(value: number | bigint, sparse?: boolean): string;
|
|
38
|
+
/**
|
|
39
|
+
* Create identifiers with references based on numeric values. The values are converted to references of the
|
|
40
|
+
* appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
41
|
+
*
|
|
42
|
+
* @param values
|
|
43
|
+
* Numeric values.
|
|
44
|
+
*
|
|
45
|
+
* @param sparse
|
|
46
|
+
* If true, the values are mapped to a sparse sequence resistant to discovery.
|
|
47
|
+
*
|
|
48
|
+
* @returns
|
|
49
|
+
* Identifiers.
|
|
50
|
+
*/
|
|
51
|
+
(values: Iterable<number | bigint>, sparse?: boolean): Iterable<string>;
|
|
52
|
+
};
|
|
41
53
|
/**
|
|
42
54
|
* Create all identifiers for the prefix from `0` to `capacity - 1`.
|
|
43
55
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/numeric-identifier-creator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/numeric-identifier-creator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAEjH;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB,CAAC,sBAAsB,SAAS,qBAAqB,GAAG,qBAAqB,CAAE,SAAQ,0BAA0B,CAAC,sBAAsB,CAAC,EAAE,iBAAiB,CAAC,sBAAsB,EAAE,2BAA2B,CAAC;IACtP;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAAC;IAEvB;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAAC;IAEpB;;OAEG;IACH,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE;IAEzB,MAAM,EAAE;QACJ;;;;;;;;;;;;WAYG;QACH,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QAEnD;;;;;;;;;;;;WAYG;QACH,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC3E,CAAC;IAEF;;;;;;;;;OASG;IACH,SAAS,EAAE,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;CACrC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type TransformerInput, type TransformerOutput } from "@aidc-toolkit/utility";
|
|
2
1
|
import type { SerializableNumericIdentifierType } from "./serializable-numeric-identifier-type.js";
|
|
3
2
|
import { SerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator.js";
|
|
4
3
|
declare const SerializableNumericIdentifierCreator_base: abstract new (...args: [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GRAI"] | [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GDTI"] | [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GCN"]) => SerializableNumericIdentifierValidator & import("./non-gtin-numeric-identifier-creator.js").NonGTINNumericIdentifierCreator<SerializableNumericIdentifierType>;
|
|
@@ -8,41 +7,65 @@ declare const SerializableNumericIdentifierCreator_base: abstract new (...args:
|
|
|
8
7
|
export declare class SerializableNumericIdentifierCreator extends SerializableNumericIdentifierCreator_base {
|
|
9
8
|
#private;
|
|
10
9
|
/**
|
|
11
|
-
* Create serialized identifier
|
|
10
|
+
* Create a serialized identifier with a reference based on a numeric value concatenated with a serial component.
|
|
12
11
|
* The value is converted to a reference of the appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
13
12
|
*
|
|
14
|
-
* @
|
|
15
|
-
*
|
|
13
|
+
* @param value
|
|
14
|
+
* Numeric value of the reference.
|
|
15
|
+
*
|
|
16
|
+
* @param serialComponent
|
|
17
|
+
* Serial component.
|
|
18
|
+
*
|
|
19
|
+
* @param sparse
|
|
20
|
+
* If true, the value is mapped to a sparse sequence resistant to discovery.
|
|
21
|
+
*
|
|
22
|
+
* @returns
|
|
23
|
+
* Serialized identifier.
|
|
24
|
+
*/
|
|
25
|
+
createSerialized(value: number | bigint, serialComponent: string, sparse?: boolean): string;
|
|
26
|
+
/**
|
|
27
|
+
* Create serialized identifiers with a reference based on a numeric value concatenated with serial components. The
|
|
28
|
+
* value is converted to a reference of the appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
16
29
|
*
|
|
17
30
|
* @param value
|
|
18
31
|
* Numeric value of the reference.
|
|
19
32
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* Serial
|
|
33
|
+
* @param serialComponents
|
|
34
|
+
* Serial components.
|
|
22
35
|
*
|
|
23
36
|
* @param sparse
|
|
24
|
-
* If true, the value is mapped to a sparse sequence resistant to discovery.
|
|
37
|
+
* If true, the value is mapped to a sparse sequence resistant to discovery.
|
|
25
38
|
*
|
|
26
39
|
* @returns
|
|
27
40
|
* Serialized identifiers.
|
|
28
41
|
*/
|
|
29
|
-
createSerialized
|
|
42
|
+
createSerialized(value: number | bigint, serialComponents: Iterable<string>, sparse?: boolean): Iterable<string>;
|
|
30
43
|
/**
|
|
31
|
-
* Concatenate a base identifier with serial component
|
|
44
|
+
* Concatenate a base identifier with a serial component.
|
|
32
45
|
*
|
|
33
|
-
* @
|
|
34
|
-
*
|
|
46
|
+
* @param baseIdentifier
|
|
47
|
+
* Base identifier.
|
|
48
|
+
*
|
|
49
|
+
* @param serialComponent
|
|
50
|
+
* Serial component.
|
|
51
|
+
*
|
|
52
|
+
* @returns
|
|
53
|
+
* Serialized identifier.
|
|
54
|
+
*/
|
|
55
|
+
concatenate(baseIdentifier: string, serialComponent: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Concatenate a base identifier with serial components.
|
|
35
58
|
*
|
|
36
59
|
* @param baseIdentifier
|
|
37
60
|
* Base identifier.
|
|
38
61
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* Serial
|
|
62
|
+
* @param serialComponents
|
|
63
|
+
* Serial components.
|
|
41
64
|
*
|
|
42
65
|
* @returns
|
|
43
|
-
* Serialized
|
|
66
|
+
* Serialized identifiers.
|
|
44
67
|
*/
|
|
45
|
-
concatenate
|
|
68
|
+
concatenate(baseIdentifier: string, serialComponents: Iterable<string>): Iterable<string>;
|
|
46
69
|
}
|
|
47
70
|
export {};
|
|
48
71
|
//# sourceMappingURL=serializable-numeric-identifier-creator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializable-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AACnG,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;;AAExG;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,yCAEjB;;IAsDrC;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM;IAE3F;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC;IAOhH;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM;IAEpE;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC;CAQ5F"}
|
|
@@ -6,24 +6,8 @@ import { SerializableNumericIdentifierValidator } from "./serializable-numeric-i
|
|
|
6
6
|
* Serializable numeric identifier creator.
|
|
7
7
|
*/
|
|
8
8
|
export class SerializableNumericIdentifierCreator extends MixinAbstractNonGTINNumericIdentifierCreator(SerializableNumericIdentifierValidator) {
|
|
9
|
-
|
|
10
|
-
* Concatenate a validated base identifier with serial component(s).
|
|
11
|
-
*
|
|
12
|
-
* @template TTransformerInput
|
|
13
|
-
* Transformer input type.
|
|
14
|
-
*
|
|
15
|
-
* @param baseIdentifier
|
|
16
|
-
* Base identifier.
|
|
17
|
-
*
|
|
18
|
-
* @param serialComponentOrComponents
|
|
19
|
-
* Serial component(s).
|
|
20
|
-
*
|
|
21
|
-
* @returns
|
|
22
|
-
* Serialized identifier(s).
|
|
23
|
-
*/
|
|
9
|
+
// eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
|
|
24
10
|
#concatenateValidated(baseIdentifier, serialComponentOrComponents) {
|
|
25
|
-
// TODO Refactor type when https://github.com/microsoft/TypeScript/pull/56941 released.
|
|
26
|
-
let result;
|
|
27
11
|
const serialComponentCreator = this.serialComponentCreator;
|
|
28
12
|
const serialComponentValidation = this.serialComponentValidation;
|
|
29
13
|
/**
|
|
@@ -39,52 +23,15 @@ export class SerializableNumericIdentifierCreator extends MixinAbstractNonGTINNu
|
|
|
39
23
|
serialComponentCreator.validate(serialComponent, serialComponentValidation);
|
|
40
24
|
return baseIdentifier + serialComponent;
|
|
41
25
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
else {
|
|
46
|
-
result = mapIterable(serialComponentOrComponents, validateAndConcatenate);
|
|
47
|
-
}
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type determination is handled above.
|
|
49
|
-
return result;
|
|
26
|
+
return typeof serialComponentOrComponents !== "object" ?
|
|
27
|
+
validateAndConcatenate(serialComponentOrComponents) :
|
|
28
|
+
mapIterable(serialComponentOrComponents, validateAndConcatenate);
|
|
50
29
|
}
|
|
51
|
-
|
|
52
|
-
* Create serialized identifier(s) with a reference based on a numeric value concatenated with serial component(s).
|
|
53
|
-
* The value is converted to a reference of the appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
54
|
-
*
|
|
55
|
-
* @template TTransformerInput
|
|
56
|
-
* Transformer input type.
|
|
57
|
-
*
|
|
58
|
-
* @param value
|
|
59
|
-
* Numeric value of the reference.
|
|
60
|
-
*
|
|
61
|
-
* @param serialComponentOrComponents
|
|
62
|
-
* Serial component(s).
|
|
63
|
-
*
|
|
64
|
-
* @param sparse
|
|
65
|
-
* If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.
|
|
66
|
-
*
|
|
67
|
-
* @returns
|
|
68
|
-
* Serialized identifiers.
|
|
69
|
-
*/
|
|
30
|
+
// eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
|
|
70
31
|
createSerialized(value, serialComponentOrComponents, sparse) {
|
|
71
32
|
return this.#concatenateValidated(this.create(value, sparse), serialComponentOrComponents);
|
|
72
33
|
}
|
|
73
|
-
|
|
74
|
-
* Concatenate a base identifier with serial component(s).
|
|
75
|
-
*
|
|
76
|
-
* @template TTransformerInput
|
|
77
|
-
* Transformer input type.
|
|
78
|
-
*
|
|
79
|
-
* @param baseIdentifier
|
|
80
|
-
* Base identifier.
|
|
81
|
-
*
|
|
82
|
-
* @param serialComponentOrComponents
|
|
83
|
-
* Serial component(s).
|
|
84
|
-
*
|
|
85
|
-
* @returns
|
|
86
|
-
* Serialized identifier(s).
|
|
87
|
-
*/
|
|
34
|
+
// eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
|
|
88
35
|
concatenate(baseIdentifier, serialComponentOrComponents) {
|
|
89
36
|
this.validate(baseIdentifier);
|
|
90
37
|
return this.#concatenateValidated(baseIdentifier, serialComponentOrComponents);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializable-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAmB,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,4CAA4C,EAAE,MAAM,mDAAmD,CAAC;AAEjH,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;AAExG;;GAEG;AACH,MAAM,OAAO,oCAAqC,SAAQ,4CAA4C,CAEpG,sCAAsC,CAAC;IA6BrC,2FAA2F;IAC3F,qBAAqB,CAAC,cAAsB,EAAE,2BAAsD;QAChG,MAAM,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC;QAC3D,MAAM,yBAAyB,GAAG,IAAI,CAAC,yBAAyB,CAAC;QAEjE;;;;;;;;WAQG;QACH,SAAS,sBAAsB,CAAC,eAAuB;YACnD,sBAAsB,CAAC,QAAQ,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC;YAE5E,OAAO,cAAc,GAAG,eAAe,CAAC;QAC5C,CAAC;QAED,OAAO,OAAO,2BAA2B,KAAK,QAAQ,CAAC,CAAC;YACpD,sBAAsB,CAAC,2BAA2B,CAAC,CAAC,CAAC;YACrD,WAAW,CAAC,2BAA2B,EAAE,sBAAsB,CAAC,CAAC;IACzE,CAAC;IAsCD,2FAA2F;IAC3F,gBAAgB,CAAC,KAAsB,EAAE,2BAAsD,EAAE,MAAgB;QAC7G,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,2BAA2B,CAAC,CAAC;IAC/F,CAAC;IA8BD,2FAA2F;IAC3F,WAAW,CAAC,cAAsB,EAAE,2BAAsD;QACtF,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,OAAO,IAAI,CAAC,qBAAqB,CAAC,cAAc,EAAE,2BAA2B,CAAC,CAAC;IACnF,CAAC;CACJ"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/gs1",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47-beta",
|
|
4
4
|
"description": "GS1 AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"test": "tsc --project tsconfig-test.json --noEmit && vitest run"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@aidc-toolkit/dev": "1.0.
|
|
32
|
+
"@aidc-toolkit/dev": "1.0.44-beta",
|
|
33
33
|
"vitest": "^4.0.18"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@aidc-toolkit/core": "1.0.
|
|
37
|
-
"@aidc-toolkit/utility": "1.0.
|
|
36
|
+
"@aidc-toolkit/core": "1.0.45-beta",
|
|
37
|
+
"@aidc-toolkit/utility": "1.0.46-beta"
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { AbstractConstructor } from "@aidc-toolkit/core";
|
|
2
|
-
import {
|
|
3
|
-
CharacterSetCreator,
|
|
4
|
-
Exclusions,
|
|
5
|
-
NUMERIC_CREATOR,
|
|
6
|
-
type TransformerInput,
|
|
7
|
-
type TransformerOutput
|
|
8
|
-
} from "@aidc-toolkit/utility";
|
|
2
|
+
import { CharacterSetCreator, Exclusions, NUMERIC_CREATOR } from "@aidc-toolkit/utility";
|
|
9
3
|
import { type IdentifierCreatorConstructor, MixinAbstractIdentifierCreator } from "./abstract-identifier-creator.js";
|
|
10
4
|
import { checkDigit, checkDigitSum } from "./check.js";
|
|
11
5
|
import type { IdentifierTypeValidator, IdentifierValidatorConstructorsEntry } from "./identifier-validators.js";
|
|
@@ -132,8 +126,16 @@ export function MixinAbstractNumericIdentifierCreator<
|
|
|
132
126
|
/**
|
|
133
127
|
* @inheritDoc
|
|
134
128
|
*/
|
|
135
|
-
create
|
|
136
|
-
|
|
129
|
+
create(value: number | bigint, sparse?: boolean): string;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @inheritDoc
|
|
133
|
+
*/
|
|
134
|
+
create(values: Iterable<number | bigint>, sparse?: boolean): Iterable<string>;
|
|
135
|
+
|
|
136
|
+
// eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
|
|
137
|
+
create(valueOrValues: number | bigint | Iterable<number | bigint>, sparse?: boolean): string | Iterable<string> {
|
|
138
|
+
return NUMERIC_CREATOR.create(this.referenceLength, valueOrValues, Exclusions.None, sparse === true ? this.tweak : undefined, reference => this.#buildIdentifier(reference));
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
/**
|