import { TransformerFunction , TMap , AnyMap } from '../typings/utils' ; example param array param transformKey param transformValue export function stringArrayToMapping < T > ( array = [ ] , transformKey = ( ( k ) => k ) , transformValue = ( ( v ) => v ) ) { return array . reduce ( ( obj , elem ) => { obj [ transformKey ( elem ) ] = transformValue ( elem ) ; return obj ; } , { } as TMap < T > ) ; } param string param additional param chars export function trimString ( string , additional = '' , chars = '\\s\\0\\x0B' ) { return string . replace ( new RegExp ( `^[${ additional + chars }]*|[${ additional + chars }]*$` , 'gim' ) , '' ) ; } param obj export function filterNullValues ( obj ) { Object . getOwnPropertyNames ( obj ) . forEach ( ( name ) => { if ( obj [ name ] === null ) { delete obj [ name ] ; } } ) ; return obj ; } param value export function isArray ( value ) { return Array . isArray ( value ) ; } param value export function isString ( value ) { return typeof value === 'string' ; } param value export function isNumber ( value ) { return typeof value === 'number' ; } param value export function isFunction ( value ) { return typeof value === 'function' ; } param value export function isObject ( value ) { return value !== null && typeof value === 'object' ; } param value export function isDefined < T > ( value ) { return typeof value !== 'undefined' && ! ( value === null ) ; } param target param key param value export function setProperty ( target , key , value ) { if ( typeof value === 'function' ) { return ; } Object . defineProperty ( target , key , { value , enumerable : true , configurable : true , writable : true , } ) ; }