INNER CODE UNIT · TypeScript

Pangu

vinta/pangu.js · src/shared/index.ts:289

export class Pangu {
  public readonly version: string = '10.4.1';

  public spaceText(text: string) {
    if (typeof text !== 'string') {
      console.warn(`[pangu] spaceText(text) only accepts string but got ${typeof text}`);
      return text;
    }

    if (text.length <= 1 || !ANY_CJK.test(text)) {
      return text;
    }

    let newText = text;

    // Hide backtick content from the quote rules; the backticks themselves still get spacing
    const backtickManager = new PlaceholderReplacer('BACKTICK_CONTENT_', '\uE000', '\uE001');
    newText = newText.replace(/`([^`]+)`/g, (_match, content: string) => {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…