PicList/src/renderer/utils/common.ts

19 lines
586 B
TypeScript
Raw Normal View History

const isDevelopment = process.env.NODE_ENV !== 'production'
/* eslint-disable camelcase */
2021-04-10 09:01:55 -04:00
export const handleTalkingDataEvent = (data: ITalkingDataOptions) => {
const { EventId, Label = '', MapKv = {} } = data
MapKv.from = window.location.href
window.TDAPP.onEvent(EventId, Label, MapKv)
if (isDevelopment) {
2021-04-10 09:01:55 -04:00
console.log('talkingData', data)
}
}
export const trimValues = (obj: IStringKeyMap) => {
const newObj = {} as IStringKeyMap
Object.keys(obj).forEach(key => {
newObj[key] = typeof obj[key] === 'string' ? obj[key].trim() : obj[key]
})
return newObj
}