@itwin/core-quantity 3.0.0-extension.0 → 3.1.0-dev.5
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/CHANGELOG.md +76 -1
- package/LICENSE.md +1 -1
- package/lib/cjs/Interfaces.d.ts +6 -2
- package/lib/cjs/Interfaces.d.ts.map +1 -1
- package/lib/cjs/Interfaces.js.map +1 -1
- package/lib/cjs/Parser.d.ts +4 -4
- package/lib/cjs/Parser.d.ts.map +1 -1
- package/lib/cjs/Parser.js +22 -17
- package/lib/cjs/Parser.js.map +1 -1
- package/lib/cjs/ParserSpec.d.ts +2 -2
- package/lib/cjs/ParserSpec.d.ts.map +1 -1
- package/lib/cjs/ParserSpec.js +2 -2
- package/lib/cjs/ParserSpec.js.map +1 -1
- package/lib/cjs/Unit.d.ts +1 -2
- package/lib/cjs/Unit.d.ts.map +1 -1
- package/lib/cjs/Unit.js +1 -2
- package/lib/cjs/Unit.js.map +1 -1
- package/lib/esm/Interfaces.d.ts +6 -2
- package/lib/esm/Interfaces.d.ts.map +1 -1
- package/lib/esm/Interfaces.js.map +1 -1
- package/lib/esm/Parser.d.ts +4 -4
- package/lib/esm/Parser.d.ts.map +1 -1
- package/lib/esm/Parser.js +22 -17
- package/lib/esm/Parser.js.map +1 -1
- package/lib/esm/ParserSpec.d.ts +2 -2
- package/lib/esm/ParserSpec.d.ts.map +1 -1
- package/lib/esm/ParserSpec.js +2 -2
- package/lib/esm/ParserSpec.js.map +1 -1
- package/lib/esm/Unit.d.ts +1 -2
- package/lib/esm/Unit.d.ts.map +1 -1
- package/lib/esm/Unit.js +1 -2
- package/lib/esm/Unit.js.map +1 -1
- package/package.json +8 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParserSpec.js","sourceRoot":"","sources":["../../src/ParserSpec.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,MAAM,EAAuB,MAAM,UA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,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEzD;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,aAA4B,EAAE,OAAkB,EAAE,qBAAmD;QAC9I,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,gCAAgC,CAAC,aAAa,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC;QACjH,OAAO,IAAI,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACtD,CAAC;IAED,0HAA0H;IACnH,oBAAoB,CAAC,QAAgB;QAC1C,OAAO,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Quantity\r\n */\r\n\r\nimport { Format } from \"./Formatter/Format\";\r\nimport { AlternateUnitLabelsProvider, UnitConversionSpec, UnitProps, UnitsProvider } from \"./Interfaces\";\r\nimport { Parser, QuantityParseResult } from \"./Parser\";\r\n\r\n/** A ParserSpec holds information needed to parse a string into a quantity synchronously.\r\n * @beta\r\n */\r\nexport class ParserSpec {\r\n private _outUnit: UnitProps;\r\n private _conversions: UnitConversionSpec[] = []; // max four entries\r\n private _format: Format;\r\n\r\n /** Constructor\r\n * @param outUnit The name of a format specification.\r\n * @param format Defines the output format for the quantity value.\r\n * @param conversions An array of conversion factors necessary to convert from an input unit to the units specified in the format..\r\n */\r\n constructor(outUnit: UnitProps, format: Format, conversions: UnitConversionSpec[]) {\r\n this._outUnit = outUnit;\r\n this._format = format;\r\n this._conversions = conversions;\r\n }\r\n\r\n /** Returns an array of UnitConversionSpecs for each unit label that may be used in the input string. */\r\n public get unitConversions(): UnitConversionSpec[] { return this._conversions; }\r\n public get format(): Format { return this._format; }\r\n public get outUnit(): UnitProps { return this._outUnit; }\r\n\r\n /** Static async method to create a ParserSpec given the format and unit of the quantity that will be passed to the Parser. The input unit will\r\n * be used to generate conversion information for each unit specified in the Format. This method is async due to the fact that the units provider must make\r\n * async calls to lookup unit definitions.\r\n * @param format The format specification.\r\n * @param unitsProvider The units provider is used to look up unit definitions and provide conversion information for converting between units.\r\n * @param outUnit The unit the value to be formatted. This unit is often referred to as persistence unit.\r\n */\r\n public static async create(format: Format, unitsProvider: UnitsProvider, outUnit: UnitProps, altUnitLabelsProvider?: AlternateUnitLabelsProvider): Promise<ParserSpec> {\r\n const conversions = await Parser.createUnitConversionSpecsForUnit(unitsProvider, outUnit, altUnitLabelsProvider);\r\n return new ParserSpec(outUnit, format, conversions);\r\n }\r\n\r\n /** Do the parsing. Done this way to allow Custom Parser Specs to parse custom formatted strings into their quantities. */\r\n public parseToQuantityValue(inString: string): QuantityParseResult {\r\n return Parser.parseQuantityString(inString, this);\r\n }\r\n}\r\n\r\n"]}
|
package/lib/esm/Unit.d.ts
CHANGED
|
@@ -10,9 +10,8 @@ export declare class BasicUnit implements UnitProps {
|
|
|
10
10
|
label: string;
|
|
11
11
|
phenomenon: string;
|
|
12
12
|
isValid: boolean;
|
|
13
|
-
alternateLabels?: string[];
|
|
14
13
|
system: string;
|
|
15
|
-
constructor(name: string, label: string, phenomenon: string,
|
|
14
|
+
constructor(name: string, label: string, phenomenon: string, system?: string);
|
|
16
15
|
}
|
|
17
16
|
/** This class is a convenience class that can be returned when a valid Unit cannot be determined.
|
|
18
17
|
* @beta
|
package/lib/esm/Unit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unit.d.ts","sourceRoot":"","sources":["../../src/Unit.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;GAEG;AACH,qBAAa,SAAU,YAAW,SAAS;IAClC,IAAI,SAAM;IACV,KAAK,SAAM;IACX,UAAU,SAAM;IAChB,OAAO,UAAS;IAChB,
|
|
1
|
+
{"version":3,"file":"Unit.d.ts","sourceRoot":"","sources":["../../src/Unit.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;GAEG;AACH,qBAAa,SAAU,YAAW,SAAS;IAClC,IAAI,SAAM;IACV,KAAK,SAAM;IACX,UAAU,SAAM;IAChB,OAAO,UAAS;IAChB,MAAM,EAAE,MAAM,CAAa;gBAEtB,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAU7E;AAED;;GAEG;AACH,qBAAa,OAAQ,YAAW,SAAS;IAChC,IAAI,SAAM;IACV,KAAK,SAAM;IACX,UAAU,SAAM;IAChB,OAAO,UAAS;IAChB,MAAM,SAAa;CAC3B"}
|
package/lib/esm/Unit.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @beta
|
|
10
10
|
*/
|
|
11
11
|
export class BasicUnit {
|
|
12
|
-
constructor(name, label, phenomenon,
|
|
12
|
+
constructor(name, label, phenomenon, system) {
|
|
13
13
|
this.name = "";
|
|
14
14
|
this.label = "";
|
|
15
15
|
this.phenomenon = "";
|
|
@@ -19,7 +19,6 @@ export class BasicUnit {
|
|
|
19
19
|
this.name = name;
|
|
20
20
|
this.label = label;
|
|
21
21
|
this.phenomenon = phenomenon;
|
|
22
|
-
this.alternateLabels = alternateLabels;
|
|
23
22
|
this.isValid = true;
|
|
24
23
|
if (system)
|
|
25
24
|
this.system = system;
|
package/lib/esm/Unit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unit.js","sourceRoot":"","sources":["../../src/Unit.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH;;GAEG;AACH,MAAM,OAAO,SAAS;
|
|
1
|
+
{"version":3,"file":"Unit.js","sourceRoot":"","sources":["../../src/Unit.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH;;GAEG;AACH,MAAM,OAAO,SAAS;IAOpB,YAAY,IAAY,EAAE,KAAa,EAAE,UAAkB,EAAE,MAAe;QANrE,SAAI,GAAG,EAAE,CAAC;QACV,UAAK,GAAG,EAAE,CAAC;QACX,eAAU,GAAG,EAAE,CAAC;QAChB,YAAO,GAAG,KAAK,CAAC;QAChB,WAAM,GAAW,SAAS,CAAC;QAGhC,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAC/F,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;YAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,MAAM;gBACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACxB;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,OAAO;IAApB;QACS,SAAI,GAAG,EAAE,CAAC;QACV,UAAK,GAAG,EAAE,CAAC;QACX,eAAU,GAAG,EAAE,CAAC;QAChB,YAAO,GAAG,KAAK,CAAC;QAChB,WAAM,GAAG,SAAS,CAAC;IAC5B,CAAC;CAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Quantity\r\n */\r\n\r\nimport { UnitProps } from \"./Interfaces\";\r\n\r\n/** This class provides basic implementation of UnitProps interface.\r\n * @beta\r\n */\r\nexport class BasicUnit implements UnitProps {\r\n public name = \"\";\r\n public label = \"\";\r\n public phenomenon = \"\";\r\n public isValid = false;\r\n public system: string = \"unknown\";\r\n\r\n constructor(name: string, label: string, phenomenon: string, system?: string) {\r\n if (name && name.length > 0 && label && label.length > 0 && phenomenon && phenomenon.length > 0) {\r\n this.name = name;\r\n this.label = label;\r\n this.phenomenon = phenomenon;\r\n this.isValid = true;\r\n if (system)\r\n this.system = system;\r\n }\r\n }\r\n}\r\n\r\n/** This class is a convenience class that can be returned when a valid Unit cannot be determined.\r\n * @beta\r\n */\r\nexport class BadUnit implements UnitProps {\r\n public name = \"\";\r\n public label = \"\";\r\n public phenomenon = \"\";\r\n public isValid = false;\r\n public system = \"unknown\";\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-quantity",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0-dev.5",
|
|
4
4
|
"description": "Quantity parsing, formatting and conversions for iModel.js",
|
|
5
5
|
"main": "lib/cjs/core-quantity.js",
|
|
6
6
|
"module": "lib/esm/core-quantity.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/
|
|
12
|
+
"url": "https://github.com/iTwin/itwinjs-core/tree/master/core/quantity"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"Bentley",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"url": "http://www.bentley.com"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@itwin/
|
|
25
|
-
"@itwin/
|
|
26
|
-
"@itwin/eslint-plugin": "3.
|
|
24
|
+
"@itwin/build-tools": "3.1.0-dev.5",
|
|
25
|
+
"@itwin/core-bentley": "3.1.0-dev.5",
|
|
26
|
+
"@itwin/eslint-plugin": "3.1.0-dev.5",
|
|
27
27
|
"@types/chai": "^4.1.4",
|
|
28
28
|
"@types/chai-as-promised": "^7",
|
|
29
29
|
"@types/glob": "^5.0.35",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"typescript": "~4.4.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@itwin/core-bentley": "^3.
|
|
43
|
+
"@itwin/core-bentley": "^3.1.0-dev.5"
|
|
44
44
|
},
|
|
45
45
|
"nyc": {
|
|
46
46
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|
|
@@ -63,5 +63,6 @@
|
|
|
63
63
|
"docs": "betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-quantity/file.json --tsIndexFile=./core-quantity.ts --onlyJson",
|
|
64
64
|
"cover": "nyc npm -s test",
|
|
65
65
|
"start": "npm run -s lint && npm run -s clean && npm run -s build && npm run -s test & npm run -s cover & npm run -s docs"
|
|
66
|
-
}
|
|
66
|
+
},
|
|
67
|
+
"readme": "# @itwin/core-quantity\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.\r\n\r\n## Description\r\n\r\nThe __@itwin/core-quantity__ package contains classes for quantity formatting and parsing.\r\n\r\n## Documentation\r\n\r\nSee the [iTwin.js](https://www.itwinjs.org) documentation for more information.\r\n"
|
|
67
68
|
}
|