@yookue/ts-lang-utils
Version:
Common lang utilities for typescript
13 lines • 401 B
JavaScript
import { toChars } from "./toChars";
export function reverse(text, startInclusive, endExclusive) {
if (!text) {
return text;
}
var substring = text.substring(startInclusive !== null && startInclusive !== void 0 ? startInclusive : 0, endExclusive);
var result = toChars(substring);
if (!result || !result.length) {
return undefined;
}
result.reverse();
return result.join('');
}