UNPKG

@mathrunet/masamune

Version:

Manages packages for the server portion (NodeJS) of the Masamune framework.

83 lines (82 loc) 2.58 kB
/** * Checks if [value] is {[key: string]: any}. * * [value]が{[key: string]: any}であるかどうかをチェックします。 * * @param value * Value to be checked. * * チェックしたい値。 * * @returns * If [value] is {[key: string]: any}, returns true; otherwise, returns false. * * [value]が{[key: string]: any}ならtrue、そうでなければfalseを返します。 */ export declare function isDynamicMap(value: any): value is { [key: string]: any; }; /** * Converts strings, numbers, etc. to the appropriate type. * * 文字列や数値などを適切な型に変換します。 * * @param {string | number} value * Strings and numbers. * 文字列か数値。 * * @return {bool | number | string} * If it is a string, a numeric value is returned; * otherwise, the input value is returned. * 文字列なら数値、そうでなければ入力値が返却されます。 */ export declare function parse(value: string | number): string | number | boolean; /** * Generate and retrieve the UUID for Version 7. * * The strings can be sorted in chronological order of generation. * * Returned as a string with 32 hyphenated characters removed. * * If [baseTime] is specified, the date and time to be generated can be adjusted. * If [reverse] is specified, the elapsed time from [baseTime] is reversed. * * Version7のUUIDを生成し取得します。 * * 文字列を生成した時系列順にソート可能です。 * * 32文字のハイフンが取り除かれた文字列として返されます。 * * [baseTime]を指定した場合、生成する日時を調節できます。 * [reverse]を指定した場合は、[baseTime]からの経過時間を反転させた値を使用します。 * * @param {Object} options - Options for UUID generation * @param {Date} [options.baseTime] - Base time for UUID generation (defaults to current time) * @param {boolean} [options.reverse=false] - Whether to reverse the timestamp * @return {string} UUID v7 without hyphens */ export declare function uuid(options?: { baseTime?: Date; reverse?: boolean; }): string; /** * Divides an array into pieces of the specified size. * * 配列を指定したサイズで分割します。 * * @param array * Array to be divided. * * 分割したい配列。 * * @param chunkSize * Size of each piece. * * 1つのピースのサイズ。 * * @returns {T[][]} * Array divided into pieces. * * 分割された配列。 */ export declare function splitArray<T>(array: T[], chunkSize: number): T[][];