get-trim-all
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

get-trim-all

npm install get-trim-all

Import

const trimAll = require('get-trim-all')

OR

import trimAll from "get-trim-all";

Use Case

  • String
let str = ' Helloworld ';

console.log(trimAll(str)); // 'helloworld'
//or
console.log(typeof trimAll(str)); // string
  • Number
let num = 1524;

console.log(trimAll(num)); // 1524
//or
console.log(typeof trimAll(num)); // number
  • Boolean
let bool = true;

console.log(trimAll(bool)); // true
//or
console.log(typeof trimAll(bool)); // boolean
  • Array of String(s)
let arr = [' google ', ' facebook '];

console.log(trimAll(arr)); // ['google', 'facebook']
//or
console.log(typeof trimAll(arr)); // object
//or
console.log(Array.isArray(trimAll(arr))); // true
  • Object
let obj = {
  name: ' Sahil Kumar ',
  age: 19,
  hobbies: [' programming ', ' badminton ']
};

console.log(trimAll(obj)); // { name: 'Sahil Kumar', age: 19, hobbies: ['programming', 'badminton'] }
//or
console.log(typeof trimAll(obj)); // object
let obj = { ' name ': ' sahil   Kumar ' }

console.log(trimAll(obj)) // { ' name ': 'sahil   Kumar' }
//or
console.log(typeof trimAll(obj)); // object
  • Array of Object
let arr = [
  { city: [' bbsr ', ' ctc '] }
];

console.log(trimAll(arr)); // [{ city: ['bbsr', 'ctc']}]
//or
console.log(typeof trimAll(arr)); // object
//or
console.log(Array.isArray(trimAll(arr))); // true

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i get-trim-all

    Weekly Downloads

    0

    Version

    1.0.4

    License

    ISC

    Unpacked Size

    2.84 kB

    Total Files

    4

    Last publish

    Collaborators

    • sahilks