UNPKG

@citrineos/util

Version:

The OCPP util module which supplies helpful utilities like cache and queue connectors, etc.

32 lines (31 loc) 1.22 kB
import type { OcppRequest } from '@citrineos/base'; /** * Calculate the size of a request. * * @param {object} request - The ocpp request. * @return {number} The size of the request (Bytes). */ export declare function getSizeOfRequest(request: OcppRequest): number; /** * Slice array into pieces according to the given size. * * @param {array} array - An array. * @param {number} size - The expected size of a batch. * @return {map} A map with index as key and batch as value. Index is the position of the 1st batch element in the given * array. Batch is a subarray of the given array. */ export declare function getBatches(array: object[] | string[] | boolean[] | number[], size: number): Map<number, object[] | string[] | boolean[] | number[]>; /** * Get the number of fraction digits in a number, e.g, 1.23 -> 2 * * @param num - The number to get the number of fraction digits * @returns The number of fraction digits */ export declare function getNumberOfFractionDigit(num: number): number; /** * Convert string to set. For example, 'a,b,c' -> new Set(['a', 'b', 'c']) * * @param input - The string to convert * @returns Set */ export declare function stringToSet(input: string): Set<string>;