@zerodep/string-trim
v2.0.5
Published
A utility to trim whitespace or specific values from the start and end of a string
Downloads
12
Readme
@zerodep/string-trim
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 { stringTrim } from '@zerodep/string-trim';
// or
const { stringTrim } = require('@zerodep/string-trim');
Using Default Space Separator
stringTrim(' some string '); // "some string"
Using Custom Separator
stringTrim('xx some string xx', 'x'); // " some string "
Unsuccessful Response
stringTrim({ not: 'a string' }); // throws ZeroDepError: Value is not a string