pangu
Version:
Paranoid text spacing for good readability, to automatically insert whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols).
20 lines (14 loc) • 443 B
text/typescript
import { readFile } from 'node:fs/promises';
import { readFileSync } from 'node:fs';
import { Pangu } from '../shared';
export class NodePangu extends Pangu {
async spacingFile(path: string) {
const data = await readFile(path, 'utf8');
return this.spacingText(data);
}
spacingFileSync(path: string) {
return this.spacingText(readFileSync(path, 'utf8'));
}
}
export const pangu = new NodePangu();
export default pangu;