wiki-article-name-encoding
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

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.

Package Sidebar

Install

npm i wiki-article-name-encoding

Weekly Downloads

1

Version

0.2.0

License

ISC

Unpacked Size

4.68 kB

Total Files

7

Last publish

Collaborators

  • derhuerst