friendly-phrase
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Friendly Phrase


Build Status npm bundle size (minified)

This module generates three-word English phrases intended for use in voice-based authentication and similar use cases. The phrases are built from hand-crafted word lists containing adjectives, colors and animal names, and are designed to be inoffensive and easy to pronounce.

Installation

npm install friendly-phrase

Example

Typescript

import { phrase } from 'friendly-phrase';
console.log(phrase());

$ Angry Olive Cobra

Javascript

const phrase = require('friendly-phrase').phrase;
console.log(phrase('-'));

$ Enchanting-Cinnamon-Caribou

API

phrase()

  • returns a string made from an adjective, color and animal name separated by spaces

phrase(sep: string)

  • returns a phrase with custom separator

phrase(sep: string, prevent: string)

  • the prevent parameter can be used to assure that the returned phrase does not match a specific string. The generated response will be validated against the prevent string and only a non-matching result will be returned. This avoids the need to check a database or do other server-side work to make sure a passphrase is 'new' for a given user or session

phrase(sep: string, prevent: string, short: boolean)

  • the short parameter, if true, will suppress the adjective and return a short phrase including only color and animal name.

Package Sidebar

Install

npm i friendly-phrase

Weekly Downloads

0

Version

1.1.0

License

ISC

Unpacked Size

163 kB

Total Files

41

Last publish

Collaborators

  • robeberhardt