import sortBy from 'lodash/sortBy'; import { Node, NodeList } from '@linkurious/ogma'; import { ICurrencyOptions, LkNodeData, LkProperty } from '@linkurious/rest-client'; export { sortBy }; export declare const CAPTION_HEURISTIC: string[]; export declare class Tools { static isEqual(v1: unknown, v2: unknown): boolean; /** * Check that a value is defined : not null and not undefined * * @param {any} value * @return {boolean} */ static isDefined(value: T): value is NonNullable; /** * Truncate a text */ static truncate(value: unknown, position: 'middle' | 'end', limit?: number): string; /** * Return a value from a nested object depending on a keyPath */ static getIn(ref: any, path: Array): any; /** * Return a clone of an object */ static clone(o: any): any; /** * Get the amount of hidden neighbors from a list of nodes * * @param nodes */ static getHiddenNeighbors(nodes: NodeList): number; /** * Return the visible degree of a node without self connection (self edge) * * @param {Node} node * @return {number} */ static getDegreeWithoutSelfConnection(node: Node): number; /** * Return a formatted version of a number */ static formatNumber(number: number): string; /** * Return true if a string is not composed only by invisible char * * @param {string} value * @return {boolean} */ static isStringFilled(value: string): boolean; static getValueFromLkProperty(property: LkProperty): null | string | number | boolean; /** * Return a formatted date as a string */ static formatDate(isoString: string, isDatetime?: boolean, timezone?: number): string | null; /** * From "+03:00" return the offset in milliseconds * @param timezone */ static timezoneToMilliseconds(timezone: string | undefined): number; static sanitizeFormattedNumber(str: string): number; /** * Return true if `n` is (or can be parsed as) a float, but is NOT an integer * * @param {any} n * @return {number} a number (NaN is `n` cannot be parsed as a number) */ static parseNumber(n: unknown): number; /** * Return an Array without duplicated keys * * @param {Array} arr * @param {string} key * @return {Array} */ static uniqBy(arr: Array, key?: string): Array; /** * Return 'image' or 'url' depending on the given string * * @param {string} value * @return {"image" | "url"} */ static getType(value: string): 'image' | 'url' | 'imageUrl' | undefined; /** * Return true if the given string is an url that match the schema handled by LKE * * @param {string} value * @return {boolean} */ private static isUrl; /** * Return true if the given string is an image extension * * @param {string} value * @return {boolean} */ private static isImage; /** * Return true if the given string is an url with an image extension * * @param {string} value * @return {boolean} */ private static isURLImage; /** * Return true if a value is not undefined, not null and not an empty string */ static valueExists(value: LkProperty): boolean; /** * Return true if `n` is (or can be parsed as) a number */ static isNumber(n: unknown): boolean; /** * return the correct property value */ static getPropertyValue(property: LkProperty, invalidAsString?: boolean, formattedDates?: boolean): undefined | null | string | number | boolean | Array; /** * Parse the given value and return a float number or NaN * * @param {any} n * @return {number} */ static parseFloat(n: unknown): number; /** * Format a currency value to string. * * eg: 4123 -> 4.123,00 $ */ static formatCurrencyValue(value: number, options: ICurrencyOptions): string; private static formatNumberToCurrency; }