A collection of my utility functions written in Typescript.
Use the npm package manager.
npm install @zrgjs/utils
Import each function as needed.
import {function1, function2} from '@zrgjs/utils/lib'
// or
const {function1, function2} = require('@zrgjs/utils/lib')
import {generateCsv} from '@zrgjs/utils/lib'
Generate a csv string from an Object with arrays of strings, where the key is the column title and all the strings from it's value array are the values from the same column.
Example:
{
"title 1": ['value.t1.1', 'value.t1.2'],
"title 2": ['value.t2.1', 'value.t2.2', 'value.t2.3']
}
Expected result:
title1,title2
value.t1.1,value.t2.1
value.t1.2,value.t2.2
,value.t2.3
All values can contain commas, it won't break the order.
import {generateGuid} from '@zrgjs/utils/lib/
Generate a 128-bit globally unique identifier.