Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | 1x 1x 22x 22x 1x 1x 608x 608x 608x 608x 608x 606x 608x 2x 2x 2x 2x 1x 1x 1x 1x 2x 608x 608x 608x 1x 1x 105x 105x 105x 600x 600x 105x 105x 105x 1x 1x 84x 84x 84x 84x 84x 84x 1x 1x 24x 24x 24x 24x 24x 81x 81x 24x 24x 24x 1x 1x 2x 2x 2x 2x 1x 1x 16x 16x 1x 1x 3x 3x 3x 3x 3x 11x 11x 3x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 1x | export class Lorem {
constructor(pure) {
this.pure = pure;
}
word(length) {
// when receiving parameter from bind, for somewhat they are in inverse order
const hasRightLength = (len, word) => word.length === len;
let properLengthWords;
if (typeof length === 'undefined') {
properLengthWords = this.pure.registeredModules.lorem.words;
} else {
properLengthWords = this.pure.registeredModules.lorem.words.filter(
hasRightLength.bind(this, length)
);
if (properLengthWords.length === 0) {
properLengthWords = this.pure.registeredModules.lorem.words.filter(
hasRightLength.bind(this, 14)
);
}
}
return this.pure.random.arrayElement(properLengthWords);
}
words(num = 3) {
const words = [];
for (let i = 0; i < num; i += 1) {
words.push(this.pure.lorem.word());
}
return words.join(' ');
}
sentence(wordCount) {
const def = wordCount || this.pure.random.number({ min: 3, max: 10 });
const sentence = this.pure.lorem.words(def);
return `${sentence.charAt(0).toUpperCase() + sentence.slice(1)}.`;
}
sentences(options = {}) {
let { sentenceCount = this.pure.random.number({ min: 2, max: 6 }) } = options;
const { separator = ' ' } = options;
const sentences = [];
for (sentenceCount; sentenceCount > 0; sentenceCount -= 1) {
sentences.push(this.pure.lorem.sentence());
}
return sentences.join(separator);
}
slug(wordCount) {
const words = this.pure.lorem.words(wordCount);
return this.pure.helpers.slugify(words);
}
paragraph(sentenceCount = 3) {
return this.pure.lorem.sentences({ sentenceCount });
}
paragraphs(options = {}) {
let { paragraphCount = 3 } = options;
const { separator = '\n \r' } = options;
const paragraphs = [];
for (paragraphCount; paragraphCount > 0; paragraphCount -= 1) {
paragraphs.push(this.pure.lorem.paragraph());
}
return paragraphs.join(separator);
}
text() {
const loremMethods = [
'lorem.word',
'lorem.words',
'lorem.sentence',
'lorem.sentences',
'lorem.paragraph',
'lorem.paragraphs',
'lorem.lines'
];
const randomLoremMethod = this.pure.random.arrayElement(loremMethods);
return this.pure.fake.parse(`{{${randomLoremMethod}}}`);
}
lines(lineCount) {
const def = lineCount || this.pure.random.number({ min: 1, max: 5 });
return this.pure.lorem.sentences({ sentenceCount: def, separator: '\n' });
}
}
|