@lhncbc/ucum-lhc 6.0.2 → 7.0.0
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/README.md +16 -28
- package/browser-dist/ucum-lhc.min.js +2 -0
- package/browser-dist/ucum-lhc.min.js.map +1 -0
- package/package.json +2 -5
- package/source/ucumLhcUtils.js +77 -55
- package/source/unit.js +215 -162
- package/source/unitString.js +2 -0
- package/source-cjs/ucumLhcUtils.js +66 -42
- package/source-cjs/ucumLhcUtils.js.map +1 -1
- package/source-cjs/unit.js +204 -160
- package/source-cjs/unit.js.map +1 -1
- package/source-cjs/unitString.js +2 -0
- package/source-cjs/unitString.js.map +1 -1
- package/browser-dist/ucum-lhc.js +0 -5234
package/README.md
CHANGED
|
@@ -16,9 +16,9 @@ functions described below. You might want to try that out first.
|
|
|
16
16
|
|
|
17
17
|
## Get the code
|
|
18
18
|
|
|
19
|
-
The ucum-lhc code is written
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
The ucum-lhc code is written as ES6 modules, but the npm package (see below)
|
|
20
|
+
also contains CommonJS modules, as well as a "browser-dist" directory with files
|
|
21
|
+
ready to use in a web browser.
|
|
22
22
|
|
|
23
23
|
Currently we have code to serve multiple purposes. The core code supports
|
|
24
24
|
the validation and conversion of UCUM unit expressions as well as a function
|
|
@@ -36,43 +36,31 @@ to install the ucum-lhc npm package. (npm is
|
|
|
36
36
|
npm install @lhncbc/ucum-lhc --save
|
|
37
37
|
|
|
38
38
|
This will install the @lhncbc/ucum-lhc directory in your node_modules diretory.
|
|
39
|
-
The dist subdirectory will contain ucum-lhc.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### Getting the code as a bower package
|
|
43
|
-
|
|
44
|
-
You can use the [bower](https://bower.io) package manager to install the
|
|
45
|
-
ucum-lhc bower package. (If you do not have bower installed on your machine
|
|
46
|
-
you can install it using npm. See https://bower.io). Install the ucum-lhc
|
|
47
|
-
package using the bower install command
|
|
48
|
-
|
|
49
|
-
bower install ucum-lhc
|
|
50
|
-
|
|
51
|
-
This will install the ucum-lhc directory in your bower_components directory.
|
|
52
|
-
The dist subdirectory will contain ucum-lhc.js and ucum-lhc.min.js (minimized
|
|
53
|
-
version of ucum-lhc.js).
|
|
39
|
+
The browser-dist subdirectory will contain ucum-lhc.min.js for use directly in a
|
|
40
|
+
browser.
|
|
54
41
|
|
|
55
42
|
## Using the code
|
|
56
43
|
|
|
57
|
-
The ucum-lhc.min.js file
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
those capabilities for units of measure on your system.
|
|
44
|
+
The ucum-lhc.min.js file includes the source code you need for the validation,
|
|
45
|
+
conversion and commensurable units functions as well as the ucum code
|
|
46
|
+
definitions file. We assume that your main motivation for including the
|
|
47
|
+
ucum-lhc code is to have those capabilities for units of measure on your system.
|
|
62
48
|
|
|
63
49
|
### Server side
|
|
64
|
-
To access those capabilities from your server side code
|
|
50
|
+
To access those capabilities from your server side code (or from client side
|
|
51
|
+
code that goes through a build system), require the npm package
|
|
65
52
|
and create a UcumLhcUtils object that contains those functions.
|
|
66
53
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
const ucum = require('@lhncbc/ucum-lhc');
|
|
55
|
+
const utils = ucum.UcumLhcUtils.getInstance();
|
|
56
|
+
|
|
57
|
+
|
|
70
58
|
### Client side
|
|
71
59
|
|
|
72
60
|
To access those capabilities from your client side code, include the
|
|
73
61
|
ucum-lhc.min.js package in your html file.
|
|
74
62
|
|
|
75
|
-
<script src="path-to-installed-package/dist/ucum-lhc.min.js"></script>
|
|
63
|
+
<script src="path-to-installed-package/browser-dist/ucum-lhc.min.js"></script>
|
|
76
64
|
|
|
77
65
|
The validation, conversion and commensurable units functions are available from
|
|
78
66
|
the _ucumPkg.UcumLhcUtils_ class. In your client side javascript code access
|