gokit
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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 string
  • fcap(str: string)

    Converts first letter of each string to uppercase

    const str = 'some string';
    console.log(fcap(str)); // Some String
  • ftrim(str: string)

    Removes all extra spaces

    const str = '  some     string   ';
    console.log(ftrim(str)); // some string
  • fname(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'
    }

Package Sidebar

Install

npm i gokit

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

6.75 kB

Total Files

8

Last publish

Collaborators

  • taslim-a-hussain