2023-04-05 23:11:07 +00:00
|
|
|
[@rakh/utils](./docs/README.md) / Exports
|
2020-11-17 11:38:51 +00:00
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
# @rakh/utils
|
2020-11-17 11:38:51 +00:00
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
## Table of contents
|
|
|
|
|
|
|
|
### Classes
|
|
|
|
|
|
|
|
- [LatLong](./docs/classes/LatLong.md)
|
|
|
|
- [limitedArray](./docs/classes/limitedArray.md)
|
|
|
|
|
|
|
|
### Variables
|
|
|
|
|
|
|
|
- [LocalStorage](./docs/modules.md#localstorage)
|
|
|
|
|
|
|
|
### Functions
|
|
|
|
|
|
|
|
- [arrayFromObj](./docs/modules.md#arrayfromobj)
|
|
|
|
- [debounce](./docs/modules.md#debounce)
|
|
|
|
- [distance](./docs/modules.md#distance)
|
|
|
|
- [extractFromObj](./docs/modules.md#extractfromobj)
|
|
|
|
- [get](./docs/modules.md#get)
|
|
|
|
- [getDays](./docs/modules.md#getdays)
|
|
|
|
- [hasOwn](./docs/modules.md#hasown)
|
|
|
|
- [hourFloor](./docs/modules.md#hourfloor)
|
|
|
|
- [isEmpty](./docs/modules.md#isempty)
|
2023-10-03 11:25:22 +00:00
|
|
|
- [kebabCase](./docs/modules.md#kebabcase)
|
2023-04-05 23:11:07 +00:00
|
|
|
- [maybePluralize](./docs/modules.md#maybepluralize)
|
2023-10-03 11:25:22 +00:00
|
|
|
- [mergeWithoutNulls](./docs/modules.md#mergewithoutnulls)
|
|
|
|
- [minuteFloor](./docs/modules.md#minutefloor)
|
2023-04-05 23:11:07 +00:00
|
|
|
- [once](./docs/modules.md#once)
|
|
|
|
- [partOfDay](./docs/modules.md#partofday)
|
|
|
|
- [throttle](./docs/modules.md#throttle)
|
2023-10-03 11:25:22 +00:00
|
|
|
- [timeToMilliseconds](./docs/modules.md#timetomilliseconds)
|
2023-04-05 23:11:07 +00:00
|
|
|
- [toHour](./docs/modules.md#tohour)
|
|
|
|
|
|
|
|
## Variables
|
|
|
|
|
|
|
|
### LocalStorage
|
|
|
|
|
|
|
|
• **LocalStorage**: `Object` = `_LocalStorage`
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
LocalStorage.ts:44
|
|
|
|
|
|
|
|
## Functions
|
|
|
|
|
|
|
|
### arrayFromObj
|
|
|
|
|
|
|
|
▸ **arrayFromObj**(`jsonObj`, `wantedFields`): `any`[]
|
|
|
|
|
|
|
|
Create an array from an Object using specified fields
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
| :------ | :------ | :------ |
|
2023-10-03 11:25:22 +00:00
|
|
|
| `jsonObj` | `object` | The Original object |
|
2023-04-05 23:11:07 +00:00
|
|
|
| `wantedFields` | `string`[] | The required fields |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`any`[]
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.arrayFromObj({ a: 1, b: 2 }, ['a', 'b']) // => [1, 2]
|
|
|
|
```
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
arrayFromObj.ts:9
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### debounce
|
|
|
|
|
|
|
|
▸ **debounce**(`fn`, `time`): `Function`
|
|
|
|
|
|
|
|
Debounce the calling of a function
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
| :------ | :------ | :------ |
|
|
|
|
| `fn` | `Function` | The function to be debounced |
|
|
|
|
| `time` | `number` | How long to wait |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`Function`
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
**`Signature`**
|
|
|
|
|
|
|
|
U.debounce(fn, time)
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
debounce.ts:12
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### distance
|
|
|
|
|
|
|
|
▸ **distance**(`lat1`, `lon1`, `lat2`, `lon2`): `number`
|
|
|
|
|
|
|
|
Calculate the distance between two lat long points
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `lat1` | `number` |
|
|
|
|
| `lon1` | `number` |
|
|
|
|
| `lat2` | `number` |
|
|
|
|
| `lon2` | `number` |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`number`
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
**`Signature`**
|
|
|
|
|
|
|
|
U.distance(lat1, long1, lat2, long2)
|
|
|
|
|
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
distance(1, 1, 2, 2) // => 157.22543203805722;
|
|
|
|
```
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
distance.ts:16
|
|
|
|
|
|
|
|
▸ **distance**(`latLong1`, `latLong2`): `number`
|
|
|
|
|
|
|
|
Calculate the distance between two lat long points
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `latLong1` | [`LatLong`](./docs/classes/LatLong.md) |
|
|
|
|
| `latLong2` | [`LatLong`](./docs/classes/LatLong.md) |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`number`
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
**`Signature`**
|
|
|
|
|
|
|
|
U.distance(latLong1, latLong2)
|
|
|
|
|
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
const a: U.LatLong = new LatLong(1, 1);
|
|
|
|
const b: U.LatLong = new LatLong(2, 2);
|
|
|
|
U.distance(a, b) // => 157.22543203805722
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
distance.ts:33
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### extractFromObj
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
▸ **extractFromObj**(`jsonObj`, `wantedFields`): `object`
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
Extract an object from another object using specific fields
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
| :------ | :------ | :------ |
|
|
|
|
| `jsonObj` | `object` | The source object |
|
|
|
|
| `wantedFields` | `string`[] | The required fields |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`object`
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
**`Signature`**
|
|
|
|
|
|
|
|
U.extractFromObj(jsonObj, wantedFields)
|
|
|
|
|
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.extractFromObj({ a: 1, b: 2 }, ['a']) // => { a: 1 }
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
extractFromObj.ts:12
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### get
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
▸ **get**(`obj`, `path`, `defaultValue?`): `unknown`
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
Get the value of an item inside an object
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Default value | Description |
|
|
|
|
| :------ | :------ | :------ | :------ |
|
2023-10-03 11:25:22 +00:00
|
|
|
| `obj` | `object` | `undefined` | The source object |
|
2023-04-05 23:11:07 +00:00
|
|
|
| `path` | `string` | `undefined` | The path to the object |
|
2023-10-03 11:25:22 +00:00
|
|
|
| `defaultValue` | `unknown` | `undefined` | A default value to be returned |
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
`unknown`
|
|
|
|
|
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.get({ a: 1, b: 2 }, 'b') // => 2
|
|
|
|
```
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
get.ts:10
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### getDays
|
|
|
|
|
|
|
|
▸ **getDays**(`startdate`, `enddate`): `number`
|
|
|
|
|
|
|
|
Get number of days between two Date objects
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `startdate` | `Date` |
|
|
|
|
| `enddate` | `Date` |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`number`
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
getDays.ts:7
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### hasOwn
|
|
|
|
|
|
|
|
▸ **hasOwn**(`obj`, `prop`): `boolean`
|
|
|
|
|
|
|
|
Check if an object has an property
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
| :------ | :------ | :------ |
|
2023-10-03 11:25:22 +00:00
|
|
|
| `obj` | `object` | The source object |
|
2023-04-05 23:11:07 +00:00
|
|
|
| `prop` | `string` | The required property |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`boolean`
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.hasOwn({bob:'1'}, 'bob') // => true
|
|
|
|
```
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
hasOwn.ts:12
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### hourFloor
|
|
|
|
|
|
|
|
▸ **hourFloor**(`timestamp`): `string`
|
|
|
|
|
|
|
|
Get the hour floor as a Base 32 string
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
| :------ | :------ | :------ |
|
|
|
|
| `timestamp` | `number` | The timestamp as a number |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`string`
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.hourFloor(1605532173) // => '1fnp540'
|
|
|
|
```
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
hourFloor.ts:10
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### isEmpty
|
|
|
|
|
|
|
|
▸ **isEmpty**(`obj`): `boolean`
|
|
|
|
|
|
|
|
Check if an object is empty
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
| :------ | :------ | :------ |
|
|
|
|
| `obj` | `object` | The object being checked |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`boolean`
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.isEmpty({}) // => true
|
|
|
|
U.isEmpty({ bob: true }) // => false
|
|
|
|
```
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
isEmpty.ts:9
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### kebabCase
|
|
|
|
|
|
|
|
▸ **kebabCase**(`inval`): `string`
|
|
|
|
|
|
|
|
Turn a string into a kebab-case string
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Parameters
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `inval` | ``null`` \| `string` |
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
`string`
|
|
|
|
|
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.kebabCase('test string') // => 'test-string'
|
|
|
|
U.kebabCase('testString') // => 'test-string'
|
|
|
|
U.kebabCase('test_string') // => 'test-string'
|
|
|
|
```
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
kebabCase.ts:10
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### maybePluralize
|
|
|
|
|
|
|
|
▸ **maybePluralize**(`count`, `noun`, `suffix?`): `string`
|
|
|
|
|
|
|
|
Maybe pluralize a count:
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Default value | Description |
|
|
|
|
| :------ | :------ | :------ | :------ |
|
|
|
|
| `count` | `number` | `undefined` | the value counting |
|
|
|
|
| `noun` | `string` | `undefined` | the name of the value |
|
|
|
|
| `suffix` | `string` | `'s'` | the suffix |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`string`
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
**`Signature`**
|
|
|
|
|
|
|
|
U.maybePluralize(number, noun, suffix)
|
|
|
|
|
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.maybePluralize(1, 'Bag', 's') // => 1 Bag
|
|
|
|
U.maybePluralize(5, 'Bag', 's') // => 5 Bags
|
|
|
|
```
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
maybePluralize.ts:16
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### mergeWithoutNulls
|
|
|
|
|
|
|
|
▸ **mergeWithoutNulls**(`startingObj`, `newObj`): `object`
|
|
|
|
|
|
|
|
Merge two objects together ignoring null values in the incoming data
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Parameters
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
| Name | Type | Description |
|
|
|
|
| :------ | :------ | :------ |
|
|
|
|
| `startingObj` | `object` | The original source object to be merged into |
|
|
|
|
| `newObj` | `object` | The new incoming data |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`object`
|
|
|
|
|
|
|
|
**`Signature`**
|
|
|
|
|
|
|
|
U.mergeWithoutNulls(startingObj, newObj)
|
|
|
|
|
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.mergeWithoutNulls({a:1, b:2}, {c:null, d:4}) // => { a:1, b:2, d:4}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
mergeWithoutNulls.ts:11
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### minuteFloor
|
|
|
|
|
|
|
|
▸ **minuteFloor**(`timestamp?`): `string`
|
|
|
|
|
|
|
|
Get the minute floor as a Base 32 string
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
| :------ | :------ | :------ |
|
|
|
|
| `timestamp?` | ``null`` \| `number` | The timestamp as a number |
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`string`
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.minuteFloor(1605532173) // => '1fnp540'
|
|
|
|
```
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Defined in
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
minuteFloor.ts:10
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### once
|
|
|
|
|
|
|
|
▸ **once**(`fn`): `Function`
|
|
|
|
|
|
|
|
Trigger a function once and then prevent it from triggering again
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `fn` | `Function` |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`Function`
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
**`Signature`**
|
|
|
|
|
|
|
|
U.once(fn)
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
once.ts:9
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### partOfDay
|
|
|
|
|
|
|
|
▸ **partOfDay**(`timeString`, `today?`): `string`
|
|
|
|
|
|
|
|
Get a string phrase for the current time of day
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Default value |
|
|
|
|
| :------ | :------ | :------ |
|
|
|
|
| `timeString` | `string` | `undefined` |
|
|
|
|
| `today` | `boolean` | `false` |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`string`
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
**`Signature`**
|
|
|
|
|
|
|
|
U.partOfDay(timeString, today)
|
|
|
|
|
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.partOfDay('13:00') // => 'Afternoon'
|
|
|
|
```
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
partOfDay.ts:11
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### throttle
|
|
|
|
|
|
|
|
▸ **throttle**(`callback`, `limit`): `Function`
|
|
|
|
|
|
|
|
Throttle the calling of a function
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `callback` | `Function` |
|
|
|
|
| `limit` | `number` |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`Function`
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
**`Signature`**
|
|
|
|
|
|
|
|
U.throttle(callback, limit)
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
throttle.ts:10
|
|
|
|
|
|
|
|
___
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
### timeToMilliseconds
|
2023-04-05 23:11:07 +00:00
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
▸ **timeToMilliseconds**(`inTime?`): `number`
|
2023-04-05 23:11:07 +00:00
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
Get milliseconds from a string of time sections
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Default value | Description |
|
|
|
|
| :------ | :------ | :------ | :------ |
|
|
|
|
| `inTime` | `string` | `''` | * |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`number`
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
**`Signature`**
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
U.timeToMilliseconds(inTime)
|
2023-04-05 23:11:07 +00:00
|
|
|
|
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
2023-10-03 11:25:22 +00:00
|
|
|
U.timeToMilliseconds('1s') // => 1000
|
|
|
|
U.timeToMilliseconds('1min') // => 60000
|
|
|
|
U.timeToMilliseconds('1 weeks') // => 604800000
|
|
|
|
U.timeToMilliseconds('5y2w30d14h30m10s') // => 161641810000
|
|
|
|
U.timeToMilliseconds('1 hour and 5 seconds') // => 3605000
|
2023-04-05 23:11:07 +00:00
|
|
|
```
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
timeToMilliseconds.ts:31
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### toHour
|
|
|
|
|
|
|
|
▸ **toHour**(`currentTimsestamp`, `extra?`): `number`
|
|
|
|
|
|
|
|
Return the number of Milliseconds to the hour for the supplied timestamp
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Default value |
|
|
|
|
| :------ | :------ | :------ |
|
|
|
|
| `currentTimsestamp` | `number` | `undefined` |
|
|
|
|
| `extra` | `number` | `0` |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`number`
|
|
|
|
|
|
|
|
*
|
|
|
|
|
2023-10-03 11:25:22 +00:00
|
|
|
**`Signature`**
|
|
|
|
|
|
|
|
U.toHour(currentTimsestamp, extra)
|
|
|
|
|
|
|
|
**`Example`**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
U.toHour('13:00') // => 1605532173
|
|
|
|
```
|
|
|
|
|
2023-04-05 23:11:07 +00:00
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
toHour.ts:12
|