@alttiri/util-js
Advanced tools
Comparing version 1.7.0 to 1.8.1
@@ -1,4 +0,2 @@ | ||
export { | ||
sleep, | ||
} from "./src/sleep"; | ||
export { sleep } from "./src/sleep"; | ||
@@ -14,1 +12,6 @@ export { | ||
} from "./src/byte-size-converter"; | ||
export { Semaphore } from "./src/sync/Semaphore"; | ||
export { CountLatch } from "./src/sync/CountLatch"; | ||
export function isString(value: unknown): value is string; |
@@ -1,4 +0,2 @@ | ||
export { | ||
sleep, | ||
} from "./src/sleep.js"; | ||
export { sleep } from "./src/sleep.js"; | ||
@@ -14,1 +12,6 @@ export { | ||
} from "./src/byte-size-converter.js"; | ||
export { Semaphore } from "./src/sync/Semaphore.js"; | ||
export { CountLatch } from "./src/sync/CountLatch.js"; | ||
export function isString(value) { return typeof value === "string" || value instanceof String; } |
{ | ||
"name": "@alttiri/util-js", | ||
"version": "1.7.0", | ||
"description": "Sleep function with setImmediate", | ||
"version": "1.8.1", | ||
"description": "Some util functions for personal use", | ||
"homepage": "https://github.com/AlttiRi/util-js", | ||
@@ -11,3 +11,5 @@ "keywords": [ | ||
"date", | ||
"size" | ||
"size", | ||
"semaphore", | ||
"isString" | ||
], | ||
@@ -14,0 +16,0 @@ "license": "MIT", |
@@ -7,2 +7,35 @@ # util-js | ||
```ts | ||
declare function sleep(ms?: number): Promise<void>; | ||
``` | ||
```ts | ||
declare function dateToDayDateString(dateValue?: Date | string | number, utc?: boolean): string; | ||
declare function dateToDayDateTimeString(dateValue?: Date | string | number, utc?: boolean): string; | ||
declare function formatDate(dateValue?: Date | string | number, pattern?: string, utc?: boolean): string; | ||
``` | ||
```ts | ||
declare function formatSizeWinLike(bytes: number): string; // aka `bytesToSizeWinLike` | ||
``` | ||
```ts | ||
declare class Semaphore { | ||
constructor(max: number); | ||
acquire(): Promise<void>; | ||
release(): void; | ||
} | ||
``` | ||
```ts | ||
declare class CountLatch { | ||
constructor(count?); | ||
countDown(): void; | ||
countUp(): void; | ||
then(resolve: VoidFunc, reject: VoidFunc): Promise<void> | ||
} | ||
``` | ||
## Installation | ||
@@ -9,0 +42,0 @@ |
@@ -1,2 +0,2 @@ | ||
// "Sun, 10 Jan 2021 22:22:22 GMT" -> "2021.01.10" | ||
/** "Sun, 10 Jan 2021 22:22:22 GMT" -> "2021.01.10" */ | ||
export function dateToDayDateString(dateValue, utc = true) { | ||
@@ -6,3 +6,3 @@ return formatDate(dateValue, "YYYY.MM.DD", utc); | ||
// "Sun, 10 Jan 2021 22:22:22 GMT" -> "2021.01.10 22:22:22Z" | ||
/** "Sun, 10 Jan 2021 22:22:22 GMT" -> "2021.01.10 22:22:22Z" */ | ||
export function dateToDayDateTimeString(dateValue, utc = true) { | ||
@@ -9,0 +9,0 @@ return formatDate(dateValue, "YYYY.MM.DD HH:mm:SS", utc) + (utc ? "Z" : ""); |
@@ -1,1 +0,1 @@ | ||
export function sleep(ms?: number): Promise<void> | ||
export function sleep(ms?: number): Promise<void>; |
12665
15
237
100