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

icelandic

v1.3.0

Published

Simple helper methods for the Icelandic language

Downloads

80

Readme

Icelandic

This is a collection of ES6 methods for dealthing with Icelandic language text.

Installing

It's available on NPM:

npm i --save icelandic

Usage

These are the methods available and what they do:

icelandic.decompose(word)

Replaces special Icelandic characters in a string with their ASCII equivalents.

const icelandic = require("icelandic");
icelandic.decompose("Sævör grét áðan því úlpan var ónýt.")
// = "Saevor gret adan thvi ulpan var onyt."

icelandic.slugify(word)

A variant of decompose that will also remove non-word characters and clean up spaces and punctuation into dashes:

const icelandic = require("icelandic");
icelandic.decompose("Sævör grét áðan því úlpan var ónýt.")
// = "Saevor-gret-adan-thvi-ulpan-var-onyt"

icelandic.alphabetical(word1, word2)

Collate function for sorting strings using Icelandic alphabetical rules.

const icelandic = require("icelandic");
["áríðandi", "ári", "árið", "Ári"].sort(icelandic.alphabetical)
// = [ "ári", "Ári", "árið", "áríðandi" ]

icelandic.isPlural(number)

Report whether an integer demands a plural or singular declension. Icelandic language has only a single plural form.

const icelandic = require("icelandic");
icelandic.isPlural(11)
// = false

icelandic.numerals(number [, gender] [, yearMode])

Encodes a number into word numbers. It supports a range up to 1021. Fractions are supported but limited to three decimals.

const icelandic = require("icelandic");
icelandic.numerals(123456789)
// = "hundrað tuttugu og þrjár milljónir fjögur hundruð fimmtíu og sex þúsund sjö hundruð áttatíu og níu"

The gender argument should be one of "kk" (masculine), "kvk" (feminine), "hvk" (neuter). Function will default to neuter if nothing is provided.

icelandic.numerals(53, "kk")
// = "fimmtíu og þrír"

icelandic.numerals(53, "kvk")
// = "fimmtíu og þrjár"

The yearMode argument can be made to get the less conventional teen form of hundreds for the range of numbers from 1000–2000.

icelandic.numerals(1985)
// = "nítján hundruð áttatíu og fimm"

icelandic.syllableCount(word)

Count the number of syllables that make up an Icelandic word. This is basically as simple as counting the vowels, except Icelandic has cases of dipthongs that need to be counted specially:

const icelandic = require("icelandic");
icelandic.syllableCount("augasteinn")
// = 3

icelandic.rhymeEncode(word [, number])

Reduces a word into a simpler version that can be matched with other similar reductions to determine if the words rhyme.

const icelandic = require("icelandic");
icelandic.rhymeEncode("heimkynninu")
// = 'h1mkininu'

The function takes a second argument that will limit the output to a number of syllables. Rhymes in Icelandic generally only use the final 1-2 syllables, so a more realistic way of determining if words rhyme would be something like comparing the final 2 syllables:

const rhymeEncode = require("icelandic").rhymeEncode;
rhymeEncode( 'augljósa', 2 ) === rhymeEncode( 'laktósa', 2 );
// = true

Additionally, the collection provides some common strings useful for internationalization:

icelandic.i18n

Exists as an object which members are names of days and months in the Icelandic language:

console.log(icelandic.i18n);
// {
//   'decimal': ',',
//   'thousands': '.',
//   'days': ['Sunnudagur', 'Mánudagur', ... ],
//   'shortDays': ['Sun', 'Mon', ... ],
//   'months': ['Janúar', 'Febrúar', ... ],
//   'shortMonths': ['Jan', 'Feb', ... ]
// }