JSPM

@zerodep/string-trimright

2.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 24
  • Score
    100M100P100Q32366F
  • License MIT

A utility to trim whitespace or specific values from the end of a string

Package Exports

  • @zerodep/string-trimright

Readme

@zerodep/string-trimright

minified size minified+gzipped size version language types

A utility to remove a specific character from the start and end of a string. Non-string values will cause a ZeroDepError to be thrown.

Full documentation is available at the zerodep.app page.

Examples

All @zerodep packages support both ESM and CJS.

import { stringTrimRight } from '@zerodep/string-trimright';
// or
const { stringTrimRight } = require('@zerodep/string-trimright');

Using Default Space Separator

stringTrimRight('   some string   '); // "some string"

Using Custom Separator

stringTrimRight('xx some string  xx', 'x'); // "xx some string "

Unsuccessful Response

stringTrimRight({ not: 'a string' }); // throws ZeroDepError: Value is not a string