npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

num-to-words-nl

v1.1.0

Published

number-to-words conversion for the Dutch language

Downloads

48

Readme

Number to Words Converter for Dutch

This NPM library is made for converting numbers into their word representations in Dutch

Deze NPM library is gemaakt om cijfers om te zetten in hun Nederlandse uitgeschreven vorm

Based on the original num-to-words and took inspiration from the german package

Features

  • Convert integers and floats to words in Dutch
  • Support for negative numbers and large numbers up to 16 characters, you can try for really large numbers but because of javascript limiations those won't be really accurate.
  • Convert currency amounts into words, supporting the euro and the US dollar, other currencies can be added in the params of the function.
  • Replace numbers in a string into words

Install

npm install num-to-words

Usage

Basic Conversion

Using require syntax:

const numtowords = require('num-to-words-nl');

console.log(numtowords.int_to_words(123)); // Outputs: "honderddrieëntwintig"
console.log(numtowords.float_to_words(45.75, { capitals: true })); // Outputs: "Vijfenveertig komma Vijfenzeventig"

Using ES6 import syntax

import { int_to_words, float_to_words } from 'num-to-words-nl';

console.log(int_to_words(123, { capitals: true })); // Outputs: "Honderddrieëntwintig"
console.log(float_to_words(45.75, { capitals: true })); // Outputs: "Vijfenveertig komma Vijfenzeventig"

The function takes 2 parameters,

Currency Conversion

const numtowords = require('num-to-words-nl');

console.log(numtowords.num_to_currency(999.99, 'USD')); // Outputs: "negenhonderdnegenennegentig dollar en negenennegentig cent"

replace numbers in a text

const numtowords = require('num-to-words-nl');

console.log(numtowords.replace_num_to_words("Ik heb 3 appels en 2 peren")); // Outputs: "Ik heb drie appels en twee peren"

write out time

const numtowords = require('num-to-words-nl')

console.log(numtowords.time_to_words("12:00")) // Outputs: "twaalf uur"

Supported Currencies

  • USD (United States Dollar)
  • EUR (Euro)

API Documentation

int_to_words(n, params)

Converts an integer n into its Dutch word representation.

  • n: The integer to be converted.
  • params: Optional object with configuration parameters (capitals for capitalizing the first letter, noWarnings to suppress warnings).

float_to_words(n, params, puntofkomma = "komma")

Converts a float n into its Dutch word representation.

  • n: The float to be converted.
  • params: Optional object with configuration parameters (capitals, noWarnings).
  • puntofkomma: Optional string to specify the separator between integer and fractional parts. By default it is komma

num_to_currency(amount, currency = 'EUR', customCurrencyNames = null)

Converts a currency amount into its Dutch word representation.

  • amount: The currency amount (float) to be converted.
  • currency: Optional string specifying the currency (default is 'EUR' for Euro).
  • customCurrencyNames: Optional object providing custom currency names.

replace_num_to_words(text)

Replaces all numeric substrings in text with their Dutch word equivalents.

  • text: The input text containing numbers to be replaced.

time_to_words(time)

Writes out the time into its Dutch word representation

  • time: The time in hh:mm format. Example: 12:10 -> tien over twaalf.

Run tests

npm run test

Run CLI command

npm nl-numtowords-cli <number>

example:

npm exec nl-numtowords-cli 99 # negenennegentig

if globally installed (npm install num-to-word-nl -g)

nl-numtowords-cli 99 # negenennegentig

Contributing

You are welcome to submit a pull request for additional languages or errors I made in the current functions

License

This project is licensed under the MIT License - see the LICENSE file for details.