0.2.0 • Published 6 years ago
wiki-article-name-encoding v0.2.0
wiki-article-name-encoding
Encode & decode Wiki(pedia) article names/slugs. See more details.
Installing
npm install wiki-article-name-encodingUsage
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 Countyencode 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) => nameIf 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.