0.2.0 • Published 5 years ago

wiki-article-name-encoding v0.2.0

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

wiki-article-name-encoding

Encode & decode Wiki(pedia) article names/slugs. See more details.

npm version build status ISC-licensed chat on gitter support me on Patreon

Installing

npm install wiki-article-name-encoding

Usage

const {encode, decode} = require('wiki-article-name-encoding')

const encoded = encode('Walentynów, Lipsko County')
console.log(encoded) // Walentyn%C3%B3w,_Lipsko_County
console.log(decode(encoded)) // Walentynów, Lipsko County

encode and decode can also be loaded separately:

const encode = require('wiki-article-name-encoding/encode')
const decode = require('wiki-article-name-encoding/decode')

API

encode(name, fileSafe = false) => slug
decode(slug) => name

If you pass true for fileSafe, encode will use filename-reserved-regex to figure out with characters not to keep unencoded. It will not respect Windows reserved file names.

Contributing

If you have a question or have difficulties using wiki-article-name-encoding, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.