url-safe-bitpacking 0.1.12 → 0.1.13
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 +6 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,16 +11,13 @@ Package for creating definitions of parametric models that can be stored as comp
|
|
|
11
11
|
| updating model entries | ✓ | ✓ | |
|
|
12
12
|
| re-using data from old model on change in definition | ½ | ¼ | |
|
|
13
13
|
| flattening and reading of the objects | ✓ | ✓ | ¿ |
|
|
14
|
+
| arrays (both bit-level as arrays of objects) | ½ | ¼ | |
|
|
14
15
|
|
|
15
16
|
## concept
|
|
16
17
|
|
|
17
|
-
The goal of this library is to offer a flexible, minimal and, variable object definition that can be stored in the browser URL. The main imagined use-case is parametric models that have nested and variable sub-object definitions.
|
|
18
|
+
The goal of this library is to offer a flexible, minimal and, variable object definition that can be stored in the browser URL. The main imagined use-case is parametric models that have nested and variable sub-object definitions. The library heavily relies on the bitpacking of custom bitwidth numeric values. Because of that, the biggest trade-off for this library is legibility. Without the related object definition, it would be impossible to reconstruct the state. The big advantage though is the ability to store rather many variables in a very condensed URL, allowing to store all information in rather short urls which then can be used for qr code generation.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
The big advantage though is the ability to store rather many variables in a very condensed URL, allowing to store all information in rather short urls which then can be used for qr code generation.
|
|
22
|
-
|
|
23
|
-
## data types
|
|
20
|
+
## bit-level data types
|
|
24
21
|
|
|
25
22
|
Currently, there are 4 data types implemented (+1 special case for safety). All data entries have a name that will behave as an attribute name in the object.
|
|
26
23
|
|
|
@@ -64,11 +61,11 @@ There is also a Version object which is a special case of the enum data type and
|
|
|
64
61
|
DataEntryFactory.createVersion(0, 8, 'version');
|
|
65
62
|
```
|
|
66
63
|
|
|
67
|
-
## attribute
|
|
64
|
+
## nested attribute definitions
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
More often than not in parametric models, certain data belongs together. It can also happen that the specific state of some values will have an impact on other ones being present (or which ranges are allowed). To be able to deal with this there is the option to nest data. I tried to come with an as concise yet versatile way of defining the object definitions.
|
|
70
67
|
|
|
71
|
-
|
|
68
|
+
### single nes
|
|
72
69
|
|
|
73
70
|
For the Double Nested arrays there are currently two variations: either an Optional type, which only accepts two values of which is an empty array and will be toggle on/off in relation to a certain boolean data entry.
|
|
74
71
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DataType } from './enums';
|
|
2
2
|
export { DataEntryFactory } from './factory';
|
|
3
|
-
export { SingleLevelContentType, NestedContentDataType, NestedContentType, DoubleLevelContentType, NonEmptyValidEntryArrayType, OptionalEntryDataType, EnumEntryDataType, PrecisionRangeType, SignificandMaxBits, FloatData, IntegerMaxBits, IntData, VersionRangeType, VersionData, BooleanData, DataEntry, DataEntryArray, } from './types';
|
|
4
|
-
export { createParserObject, getStateValue, getBase64String } from './objectmap';
|
|
3
|
+
export { SingleLevelContentType, NestedContentDataType, NestedContentType, DoubleLevelContentType, NonEmptyValidEntryArrayType, OptionalEntryDataType, EnumEntryDataType, PrecisionRangeType, SignificandMaxBits, FloatData, IntegerMaxBits, IntData, VersionRangeType, VersionData, BooleanData, DataEntry, DataEntryArray, StateDataType, StateValueType, EnumSemantics, } from './types';
|
|
4
|
+
export { createParserObject, getStateValue, getBase64String, getDataEntryArray } from './objectmap';
|
|
5
5
|
export { parseBase64ToBits } from './parsers';
|
|
6
6
|
export { interpolateEntryAt, getRelativeValue } from './utils';
|
package/dist/index.js
CHANGED