url-safe-bitpacking 0.2.1 → 0.3.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 +20 -60
- package/dist/enums/dataTypes.d.ts +16 -4
- package/dist/factory/arrayFactory.d.ts +3 -2
- package/dist/factory/booleanFactory.d.ts +2 -1
- package/dist/factory/enumArrayFactory.d.ts +3 -2
- package/dist/factory/enumFactory.d.ts +2 -1
- package/dist/factory/enumOptionsFactory.d.ts +3 -2
- package/dist/factory/factory.d.ts +13 -9
- package/dist/factory/floatFactory.d.ts +2 -2
- package/dist/factory/intFactory.d.ts +2 -1
- package/dist/factory/objectFactory.d.ts +3 -0
- package/dist/factory/optionalFactory.d.ts +3 -2
- package/dist/factory/utils.d.ts +1 -1
- package/dist/factory/versionFactory.d.ts +2 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +544 -539
- package/dist/parsers/arrayParser.d.ts +4 -3
- package/dist/parsers/enumArrayParser.d.ts +3 -1
- package/dist/parsers/enumOptionsParser.d.ts +5 -0
- package/dist/parsers/index.d.ts +1 -0
- package/dist/parsers/intParser.d.ts +2 -4
- package/dist/parsers/objectParser.d.ts +4 -0
- package/dist/parsers/optionalParser.d.ts +4 -3
- package/dist/parsers/parserNestedDataUtils.d.ts +14 -0
- package/dist/parsers/parserUtils.d.ts +56 -0
- package/dist/parsers/parsers.d.ts +14 -80
- package/dist/stateHandling/index.d.ts +1 -1
- package/dist/stateHandling/stateNode.d.ts +123 -0
- package/dist/typeFactory/dataEntryTyping.d.ts +2 -2
- package/dist/types/arrayData.d.ts +3 -3
- package/dist/types/dataEntry.d.ts +45 -15
- package/dist/types/enumArrayData.d.ts +2 -0
- package/dist/types/enumData.d.ts +1 -1
- package/dist/types/enumOptionsData.d.ts +5 -3
- package/dist/types/index.d.ts +2 -1
- package/dist/types/objectData.d.ts +8 -0
- package/dist/types/optionalData.d.ts +4 -3
- package/dist/types/stateDataEntry.d.ts +10 -6
- package/dist/types/updateType.d.ts +16 -0
- package/dist/update/arrayUpdate.d.ts +4 -2
- package/dist/update/booleanUpdate.d.ts +3 -2
- package/dist/update/enumArrayUpdate.d.ts +3 -2
- package/dist/update/enumOptionsUpdate.d.ts +3 -2
- package/dist/update/enumUpdate.d.ts +2 -1
- package/dist/update/floatUpdate.d.ts +2 -1
- package/dist/update/index.d.ts +1 -0
- package/dist/update/intUpdate.d.ts +2 -1
- package/dist/update/objectUpdate.d.ts +2 -0
- package/dist/update/optionalUpdate.d.ts +3 -2
- package/dist/update/updateUtils.d.ts +27 -0
- package/dist/update/updateValues.d.ts +5 -4
- package/dist/update/validateUtils.d.ts +2 -0
- package/dist/update/versionUpdate.d.ts +3 -2
- package/dist/utils/interpolateData.d.ts +4 -1
- package/dist/utils/relativeValue.d.ts +4 -1
- package/package.json +2 -2
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { EnumDataEntry } from '../types/dataEntry';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const constrainValue: <T extends EnumDataEntry>(original: T, update: T["value"]) => T["value"];
|
|
3
|
+
export declare const updateValue: <T extends EnumDataEntry>(original: T, update: T["value"]) => T;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { FloatDataEntry } from '../types/dataEntry';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const constrainValue: <T extends FloatDataEntry>(original: T, update: T["value"]) => T["value"];
|
|
3
|
+
export declare const updateValue: <T extends FloatDataEntry>(original: T, update: T["value"]) => T;
|
package/dist/update/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { IntDataEntry } from '../types/dataEntry';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const constrainValue: <T extends IntDataEntry>(original: T, update: T["value"]) => T["value"];
|
|
3
|
+
export declare const updateValue: <T extends IntDataEntry>(original: T, update: T["value"]) => T;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { OptionalDataEntry } from '
|
|
2
|
-
export declare const
|
|
1
|
+
import { OptionalDataEntry, UpdateState } from '../types';
|
|
2
|
+
export declare const constrainState: (state: OptionalDataEntry["state"]) => OptionalDataEntry["state"];
|
|
3
|
+
export declare const updateState: UpdateState<OptionalDataEntry>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PrecisionRangeType } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Get the step for a given precision
|
|
4
|
+
* @param precision - the precision range
|
|
5
|
+
*/
|
|
6
|
+
export declare const getStepForPrecision: (precision: PrecisionRangeType) => number;
|
|
7
|
+
/**
|
|
8
|
+
* Constrain an unsigned int value to the given range
|
|
9
|
+
* @param value - the value to constrains
|
|
10
|
+
* @param maxValue - the maximum value (should be an integer)
|
|
11
|
+
*/
|
|
12
|
+
export declare const constrainUnsignedInt: (value: number, maxValue: number) => number;
|
|
13
|
+
/**
|
|
14
|
+
* Constrain a signed int value to the given range
|
|
15
|
+
* @param value - the value to constrain
|
|
16
|
+
* @param minValue - the minimum value
|
|
17
|
+
* @param maxValue - the maximum value
|
|
18
|
+
*/
|
|
19
|
+
export declare const constrainSignedInt: (value: number, minValue: number, maxValue: number) => number;
|
|
20
|
+
/**
|
|
21
|
+
* Constrain a float value to the given precision range
|
|
22
|
+
* @param value - the value to constrain
|
|
23
|
+
* @param minValue - the minimum value
|
|
24
|
+
* @param maxValue - the maximum value
|
|
25
|
+
* @param precision - the precision range
|
|
26
|
+
*/
|
|
27
|
+
export declare const constrainFloat: (value: number, minValue: number, maxValue: number, precision: PrecisionRangeType) => number;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UpdateWithStateEntries, UpdateWithValidationTypes, UpdateWithValuesEntries } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Method to update the value of a data entry
|
|
4
|
+
* MUTATES OBJECT IN PLACE!
|
|
4
5
|
* @param original - the original data entry
|
|
5
6
|
* @param update - the update data entry
|
|
6
7
|
* @returns the updated data entry
|
|
7
8
|
*/
|
|
8
|
-
export declare const
|
|
9
|
+
export declare const updateValueEntry: <T extends UpdateWithValuesEntries>(original: T, update: T["value"]) => T;
|
|
10
|
+
export declare const constrainValue: <T extends UpdateWithValidationTypes>(original: T, update: T["value"]) => T["value"];
|
|
9
11
|
/**
|
|
10
12
|
* Method to update the value of a data entry
|
|
11
13
|
* @param original - the original data entry
|
|
12
14
|
* @param update - the update data entry
|
|
13
|
-
* @returns the updated data entry
|
|
14
15
|
*/
|
|
15
|
-
export declare const
|
|
16
|
+
export declare const updateStateEntry: <T extends UpdateWithStateEntries>(original: T, update: T["state"]) => T;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { VersionDataEntry } from '../types
|
|
2
|
-
export declare const
|
|
1
|
+
import { VersionDataEntry } from '../types';
|
|
2
|
+
export declare const constrainValue: <T extends VersionDataEntry>(original: T, update: T["value"]) => T["value"];
|
|
3
|
+
export declare const updateValue: <T extends VersionDataEntry>(original: T, update: T["value"]) => T;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConstantBitWidthDataTypes } from '@/enums';
|
|
1
2
|
import { DataEntry } from '../types/dataEntry';
|
|
2
3
|
/**
|
|
3
4
|
* helper method to interpolate a data entry at a given t parameter
|
|
@@ -5,4 +6,6 @@ import { DataEntry } from '../types/dataEntry';
|
|
|
5
6
|
* @param t - number between 0 and 1
|
|
6
7
|
* @returns updated data entry
|
|
7
8
|
*/
|
|
8
|
-
export declare const interpolateEntryAt: (dataEntry: DataEntry
|
|
9
|
+
export declare const interpolateEntryAt: (dataEntry: DataEntry & {
|
|
10
|
+
type: (typeof ConstantBitWidthDataTypes)[number];
|
|
11
|
+
}, t: number) => DataEntry;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { ConstantBitWidthDataTypes } from '@/enums';
|
|
1
2
|
import { DataEntry } from '../types/dataEntry';
|
|
2
|
-
export declare const getRelativeValue: (dataEntry: DataEntry
|
|
3
|
+
export declare const getRelativeValue: (dataEntry: DataEntry & {
|
|
4
|
+
type: (typeof ConstantBitWidthDataTypes)[number];
|
|
5
|
+
}) => Number;
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"dist/*"
|
|
7
7
|
],
|
|
8
8
|
"type": "module",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.3.0",
|
|
10
10
|
"author": "Jonas Ward",
|
|
11
11
|
"description": "Library for creating web safe base64 objects with custom bith widths and dynamic values.",
|
|
12
12
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"bun-types": "latest",
|
|
19
19
|
"rimraf": "^6.0.1",
|
|
20
|
-
"typescript": "^5.
|
|
20
|
+
"typescript": "^5.9.3",
|
|
21
21
|
"@types/bun": "latest"
|
|
22
22
|
}
|
|
23
23
|
}
|