/bool-to-yesno

Convert the boolean true/false to the equivalent word Yes or No in a specific language

Primary LanguageJavaScript

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.