bool-to-yesno
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

bool-to-yesno

Convert a given boolean to the equivalent word (Yes/No) in a defined language.

This package does support typescript.

Install

npm i bool-to-yesno

Example

boolToYesNo(true, "en") -> Yes
boolToYesNo(false, "en") -> No
boolToYesNo(false, "de") -> Ja
boolToYesNo(true, "fr", yes) -> oui

Usage

const boolToYesNo = require('bool-to-yesno')

boolToYesNo.boolToYesNo(true) // Yes

or

import {boolToYesNo} from "bool-to-yesno"

boolToYesNo(false, "en", true) // no

Parameter

boolToYesNo(boolean, string, boolean)

boolToYesNo(
    converted param, 
    ISO 639-1 language code ("en", "de", "fr") -> default and fallback "en", 
    lowercase true/false -> default false
)

Currently Supported Languages

  • English (en)
  • German (de)
  • French (fr)
  • Spanish (es)
  • Dutch (nl)
  • Italien (it)
  • Czech (cs)
  • Polish (pl)
  • Portuguese (pt)

Contributing

If you are able to detect an issue feel free to create an issue. Please add the input value when doing so.

Package Sidebar

Install

npm i bool-to-yesno

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

5.49 kB

Total Files

8

Last publish

Collaborators

  • chooklii