Integration Guide

Guide Développeur

Embed placeholder text directly into TypeScript, React, Next.js, and automated frontend testing suites.

/**
 * Standalone Zero-Dependency Ipsum Helper (IpsumForge)
 */
export function generateIpsum(count: number = 3, mode: 'paras' | 'words' = 'paras'): string {
  const vocabulary = [
    'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit',
    'sed', 'do', 'eiusmod', 'tempor', 'incididunt', 'ut', 'labore', 'et', 'dolore',
    'magna', 'aliqua', 'enim', 'ad', 'minim', 'veniam', 'quis', 'nostrud'
  ];

  if (mode === 'words') {
    const words: string[] = [];
    for (let i = 0; i < count; i++) {
      words.push(vocabulary[Math.floor(Math.random() * vocabulary.length)]);
    }
    return words.join(' ');
  }

  const paragraphs: string[] = [];
  for (let p = 0; p < count; p++) {
    const sentences: string[] = [];
    for (let s = 0; s < 5; s++) {
      const sentenceWords: string[] = [];
      const len = Math.floor(Math.random() * 8) + 8;
      for (let w = 0; w < len; w++) {
        sentenceWords.push(vocabulary[Math.floor(Math.random() * vocabulary.length)]);
      }
      let sent = sentenceWords.join(' ');
      sent = sent.charAt(0).toUpperCase() + sent.slice(1) + '.';
      sentences.push(sent);
    }
    paragraphs.push(sentences.join(' '));
  }
  return paragraphs.join('\n\n');
}