2020-05-15 12:18:37 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) Sapphirecode - All Rights Reserved
|
|
|
|
* This file is part of utilities which is released under MIT.
|
|
|
|
* See file 'LICENSE' for full license details.
|
|
|
|
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
|
|
|
*/
|
|
|
|
|
2020-04-27 12:40:54 +02:00
|
|
|
/**
|
|
|
|
* truncates a floating point number
|
|
|
|
*
|
|
|
|
* @param {number} num number to truncate
|
|
|
|
* @param {number} len length to truncate to
|
|
|
|
* @returns {number} truncated number
|
|
|
|
*/
|
|
|
|
export function truncate_decimal(num: number, len: number): number;
|
|
|
|
/**
|
|
|
|
* parse json and catch invalid strings
|
|
|
|
*
|
|
|
|
* @param {string} text input
|
|
|
|
* @returns {any} parsed
|
|
|
|
*/
|
|
|
|
export function try_parse_json(text: string): any;
|
|
|
|
/**
|
|
|
|
* copy an object to prevent modification to the original
|
|
|
|
*
|
|
|
|
* @param {object} obj object to copy
|
|
|
|
* @returns {object} copy
|
|
|
|
*/
|
2020-04-24 09:47:36 +02:00
|
|
|
export function copy_object(obj: any): any;
|
2020-04-27 12:40:54 +02:00
|
|
|
/**
|
|
|
|
* run a regular expression and callback for every result
|
|
|
|
*
|
|
|
|
* @param {any} regex regular expression
|
|
|
|
* @param {any} data data to run on
|
|
|
|
* @param {any} func function to execute
|
|
|
|
*/
|
2020-04-24 09:47:36 +02:00
|
|
|
export function run_regex(regex: any, data: any, func: any): void;
|
2020-04-27 12:40:54 +02:00
|
|
|
/**
|
|
|
|
* check if an object is either undefined, null or NaN
|
|
|
|
*
|
|
|
|
* @param {any} obj object to check
|
|
|
|
* @returns {boolean} true if nil
|
|
|
|
*/
|
|
|
|
export function is_nil(obj: any): boolean;
|