import { Injectable } from '@angular/core'; @Injectable() export class UtilsService { keys(obj: Object){ return Object.keys(obj); } cut(oldStr, fullStr) { return fullStr.split(oldStr).join(''); } titleCase(words: string, seperator: string = ' ', joiner: string = ' '){ return words.split(seperator).map((word)=>{ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); }).join(joiner); } camelCase(words: string, seperator: string = '_', joiner: string = ''){ return words.split(seperator).map((word, i)=>{ return (i == 0) ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); }).join(joiner); } }