2.0.5 • Published 2 months ago
@zerodep/string-trimright v2.0.5
@zerodep/string-trimright
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