Socket
Socket
Sign inDemoInstall

lorem-en

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    lorem-en

lorem text for english, compatible with browser and nodejs


Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Install size
34.2 kB
Created
Weekly downloads
 

Readme

Source

lorem-en

lorem-en maybe the tiniest Javascript module to generate lorem English text. It's written by Typescript, compatible with browser and nodejs.

Install

npm install lorem-en

Use

// ESM
import LoremEn from 'lorem-en';
// CommonJS
const LoremEn = require('lorem-en');
const loremEn = new LoremEn();

// e.g. return a random word
loremEn.word();

Params

const loremEn = new LoremEn({
  random: 10,
});

// index.d.ts
interface ILoremEnConfig {
  random: number; // base random number, default is 10
}

API

NameDescription
letter(): stringReturn a random letter
word(range?: number | IRange): string[range: Optional] Return a random word. When range is number, the word consists of range letters; range is a range array ([min, max]), and the number of words is randomly between [min, max]. When no parameter is passed, the number of words will be randomly determined based on the global parameter random
sentence(range?: number | IRange) )[range: Optional] returns a random sentence. When range is number, the sentence consists of range words; range is a range array ([min, max]), and the number of words is randomly between [min, max]. When no parameters are passed, the number will be randomly determined based on the global parameter random
paragraph(range: number | IRange )[range: Optional] Returns a random paragraph. When range is number, the paragraph consists of range sentences; range is a range array ([min, max]), and the number of sentences is randomly between [min, max]. When no parameters are passed, the number will be randomly determined based on the global parameter random
num(range: IRange): numberReturns a random number between [min,max], inclusive of min and max. Note: min and max can be any number (except Infinity and -Infinity), the absolute value of min and max will be compared during calculation, so the position of min and max is not important
randomArrayItem(arr: T[]): TRandomly returns an element in an array
name(params: INames): stringRandomly returns  common English names

Keywords

FAQs

Last updated on 14 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc