reverseString
A function that reverses and returns a given string.
Uses the spread operator to support unicode strings.
Code
Interface
typescript
function reverseString(value: string): string
References
Usage
typescript
import { reverseString } from '@modern-kit/utils';
const reversedInvalidValue = reverseString(undefined) // ''
const normalString = 'ABC가나다';
const reversedNormalString = reverseString(normalString); // '다나가CBA'
const stringWithSpecialCharacter = 'A!B@C';
const reversedStringWithSpecialCharacter = reverseString(stringWithSpecialCharacter); // 'C@B!A'
const stringWithUnicodeCharacter = 'foo 𝌆 bar';
const reversedStringWithUnicodeCharacter = reverseString(stringWithUnicodeCharacter) // 'rab 𝌆 oof'