Utils: `type-coercion`
Table of contents
Variables
Functions
Variables
MAX_STRING_LENGTH_BEFORE_MD5
• Const
MAX_STRING_LENGTH_BEFORE_MD5: 1024
If we have a hash that is a long value we want to ensure that the value doesn't explode the memory since we may be using that value as a key. So when a string exceeds this specified length we can reduce its length to 35 characters by using md5
Defined in
packages/utils/src/type-coercion.ts:155
Functions
coerceToGeoBoundary
▸ coerceToGeoBoundary(input
): GeoBoundary
Convert value to a GeoBoundary data type, a GeoBoundary is two GeoPoints, one representing the top left, the other representing the bottom right
Parameters
Name | Type |
---|---|
input | unknown |
Returns
GeoBoundary
Defined in
packages/utils/src/type-coercion.ts:110
coerceToGeoPoint
▸ coerceToGeoPoint(input
): GeoPoint
Convert value to a GeoPoint data type
Parameters
Name | Type |
---|---|
input | unknown |
Returns
GeoPoint
Defined in
packages/utils/src/type-coercion.ts:101
coerceToNumberType
▸ coerceToNumberType(type
): (input
: unknown
) => number
Parameters
Name | Type |
---|---|
type | FieldType |
Returns
fn
▸ (input
): number
Parameters
Name | Type |
---|---|
input | unknown |
Returns
number
Defined in
packages/utils/src/type-coercion.ts:66
coerceToType
▸ coerceToType<T
>(fieldConfig
, childConfig?
): CoerceFN
<T
>
Will return a function that will coerce the input values to the DataTypeFieldConfig provided. The parameter childConfig is only necessary with Tuple or Object field types
Type parameters
Name | Type |
---|---|
T | unknown |
Parameters
Name | Type |
---|---|
fieldConfig | DataTypeFieldConfig |
childConfig? | DataTypeFields |
Returns
CoerceFN
<T
>
Defined in
packages/utils/src/type-coercion.ts:29
getHashCodeFrom
▸ getHashCodeFrom(value
): string
Generate a unique hash code from a value, this is not a guarantee but it is close enough for doing groupBys and caching
Parameters
Name | Type |
---|---|
value | unknown |
Returns
string
Defined in
packages/utils/src/type-coercion.ts:162
md5
▸ md5(value
): string
Parameters
Name | Type | |
---|---|---|
value | string \ | Buffer |
Returns
string