1.1.0 • Published 3 years ago
gokit v1.1.0
gokit
Handy functions
Import
CJS
// Default import
const gokit = require('gokit');
// Named import
const {cap} = require('gokit');ESM
// Default import
import gokit from 'gokit';
// Named import
import {cap} from 'gokit';Functions
cap(str:string)Converts first letter to uppercase
const str = 'some string'; console.log(cap(str)); // Some stringfcap(str: string)Converts first letter of each string to uppercase
const str = 'some string'; console.log(fcap(str)); // Some Stringftrim(str: string)Removes all extra spaces
const str = ' some string '; console.log(ftrim(str)); // some stringfname(str: string)Breaks fullname into 3 parts (firstname, middlename, lastname). Returns an object with keys (first, middle, last). Removes all extra spaces and converts all letters to lowercase.
const fullname = ' Mike John Doe Ali '; console.log(fname(fullname)) // output ⬇️ { first: 'mike', middle: 'john doe', last: 'ali' }