Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.
/ s-trimmer Public archive

๐Ÿš€ Format spaces from the left and right end of a string and between strings

License

Notifications You must be signed in to change notification settings

JB1905/s-trimmer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

66 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NPM version NPM downloads NPM license Codecov Travis Bundle size

About

Format spaces from the left and right end of a string and between strings

Similar Projects

Remove spaces from text:

Remove spaces from class names (one of the many features):

How to Install

First, install the library in your project by npm:

$ npm install s-trimmer

Or Yarn:

$ yarn add s-trimmer

Getting Started

Connect the library to the project with ES6 import:

import sTrimmer, {
  trim,
  trimStart,
  trimLeft,
  trimEnd,
  trimRight,
  trimBetween,
  trimCenter,
} from 's-trimmer';

Or CommonJS:

const sTrimmer = require('s-trimmer').default;
const {
  trim,
  trimStart,
  trimLeft,
  trimEnd,
  trimRight,
  trimBetween,
  trimCenter,
} = require('s-trimmer');

Next use library:

sTrimmer - default export, (alias trim) - named export

const value = '    lorem  ipsum dolor  ';

sTrimmer(value); // 'lorem ipsum dolor'
trim(value); // 'lorem ipsum dolor'

trimStart (alias trimLeft)

const value = '    lorem  ipsum dolor  ';

trimStart(value); // 'lorem  ipsum dolor  '
trimLeft(value); // 'lorem  ipsum dolor  '

trimEnd (alias trimRight)

const value = '    lorem  ipsum dolor  ';

trimEnd(value); // '    lorem  ipsum dolor'
trimRight(value); // '    lorem  ipsum dolor'

trimBetween (alias trimCenter)

const value = '    lorem  ipsum dolor  ';

trimBetween(value); // '    lorem ipsum dolor  '
trimCenter(value); // '    lorem ipsum dolor  '

Params

Type Description
string Value to be formatted

License

This project is licensed under the MIT License ยฉ 2020-present Jakub Biesiada