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

zany

v1.0.6

Published

Encode & decode any text into any custom alphabet, multibyte code points supported.

Downloads

67

Readme

coverage build

Zany Encoder

Encode & decode any text into any custom alphabet, multibyte code points supported.

Install

npm i zany

Example

var zany=require("zany")
	,{encode,decode}=zany(zany.block.EGYPTIAN_HIEROGLYPHS)//for example
	,message="secret message to encode!"
	,encoded=encode(message)//𓀍𓅆𓀀𓀌𓊷𓀀𓀂𓂳𓀀𓋡𓀀𓐌𓀀𓀘𓈔𓀀𓂇𓀀𓀂𓌂𓀀𓀋
	,decoded=decode(encoded)//===message

Characters grouped by Unicode 9.0 blocks are available at zany.block.* via lazy-unicode.

More Examples

var zany=require("zany")
	,message="How now brown cow?"
	,alphabets={ //make up some alphabets
		 food:`🍇🍈🍉🍊🍋🍌🍍🍎🍏🍐🍑🍒🍓🍅🍠🍢🍣🍤🍥🍡🍦🍧🍨🍩🍪🎂🍰🍫🍬🍭🍮🍯`
		,faces:`😀😁😂😃😄😅😆😉😊😋😎😍😘😗😙😚🙂😐😑😶😏😣😥😮😪😫😌😛😜😝😒😓😔😕🙁😖😟😭😨😩😬😰😱😳😵😡😠😇`
		,animals:`🙈🐵🐒🐶🐕🐩🐺🐱🐈🐯🐅🐆🐴🐎🐮🐂🐃🐄🐷🐖🐗🐽🐑🐐🐫🐘🐭🐁🐀🐹🐰🐇🐿🐼🐾🐔🐤🐥🐦🐧🕊🕷`
		,whitespace:`           
 `
		,zwsp:`‪‭⁠⁡⁢⁣⁤⁦⁧⁨⁩𛲠𛲡𛲢𛲣𝅳𝅴𝅵𝅶𝅷𝅸𝅹𝅺󠀁`
		//or use predefined blocks
		,futhark  :zany.block.RUNIC
		,cuneiform:zany.block.CUNEIFORM
		,cards    :zany.block.PLAYING_CARDS
		,dominoes :zany.block.DOMINO_TILES
		,boxes    :zany.block.BOX_DRAWING
		,braille  :zany.block.BRAILLE_PATTERNS//(note this does not make READABLE braille!)
		,zalgo    :zany.block.ZALGO
	}
for(var i in alphabets){
	var {encode,decode}=zany(alphabets[i])
		,e=encode(message)
		,d=decode(`characters not part ${e} of the original alphabet will be discarded`)
	console.log(`${i}(${alphabets[i].length}):${e}//${d}`)
}
/*outputs:
food(64):🍉🍎🍅🍇🍉🍤🍌🍋🍇🍊🍊🍇🍉🍈🍧🍩🍇🍉🍍🍌🍇🍒🍣🍩🍇🍥🍡🍏🍇🍢🍧🍏🍇🍊🍌🍎🍌//How now brown cow?
faces(96):😫😔😀😣😪🙁😀😂😑😀😙😭😫😀😪😬😀😅😛😬😀😊😓😒😀😉😑😝😀😝😨😌//How now brown cow?
animals(84):🐹🐴🙈🐁🐧🐇🙈🐒🐫🙈🐖🐩🐴🙈🐀🐮🙈🐱🐵🐴🙈🐆🐶🐆🙈🐯🐃🐖🙈🐦🐔🐭//How now brown cow?
whitespace(13):                                            //How now brown cow?
zwsp(43):⁠󠀁‪⁠𝅷𝅷𝅸‪⁡⁦‪⁠⁧⁤‪⁠⁩𛲢‪‭⁤‪𝅳⁡𝅷‪𛲠𝅴𛲠‪⁡𛲡𛲢𛲣//How now brown cow?
futhark(97):ᚭᚨᚠᚥᛸᛯᚠᛡᚠᚤᚾᚢᚠᚬᛡᚠᚢᚪᚲᚠᚢᛱᚧᚠᚢᛓᛢᚠᚧᛷᛡ//How now brown cow?
cuneiform(2050):𒀂𒂈𒀀𒀭𒃯𒀀𒁁𒀀𒀞𒋢𒀀𒀂𒁡𒀀𒀊𒍲𒀀𒀑𒈇𒀀𒀎𒌂𒀀𒀿𒂁//How now brown cow?
cards(194):🂭🂨🂠🂥🃸🃯🂠🃡🂠🂤🂾🂢🂠🂬🃡🂠🂢🂪🂲🂠🂢🃱🂧🂠🂢🃓🃢🂠🂧🃷🃡//How now brown cow?
dominoes(226):🀻🁘🀰🀴🁵🁟🀰🁱🀰🀳🁠🂂🀰🀻🀱🀰🂋🁂🀰🀲🁗🂗🀰🀲🀾🂂🀰🀶🀹🀱//How now brown cow?
boxes(129):┊┈─┃╢╯─╁─│╮╢─┉╡─╏╲─│┅┇─╯│─┄╲━//How now brown cow?
braille(257):⠅⢈⠀⢱⣯⠀⡁⠀⡷⣢⠀⠅⡡⠀⠨⡲⠀⡃⠇⠀⠸⠂⠀⣹⢁//How now brown cow?
zalgo(125):̯̊͏᷊̦̃͏̈́͏̹̂︡͏̊̅͏͖̹͏̪̂̍͏͉᷆͏̅̓̅//How now brown cow?
*/

Or, if you have too many friends, define a semantic whitespace decoder in one file:

\u1160=x=>eval(zany(`‪‭⁠⁡⁢⁣⁤⁦⁧⁨⁩𛲠𛲡𛲢𛲣𝅳𝅴𝅵𝅶𝅷𝅸𝅹𝅺󠀁`).decode(x))

Then somewhere, far, far away that shares scope, execute it:

ᅠ`⁠‪𝅹⁦‪⁡⁧⁢‪⁡⁣𝅶𝅶‪𛲠⁠‪⁠‭⁦‪𝅹‪⁤‪⁠𛲣⁠𛲣‪𛲡𝅵⁡‪⁠⁦𝅸‪⁨𛲢‪⁣𝅹‪⁠𛲠𛲢‪𛲡⁠‪⁡⁦𛲣‪𛲡𝅵‪⁣𝅸‪⁩𝅵⁠‪⁠𝅸‪⁡⁡𝅸𛲡‪⁩𝅶𛲠‪⁠𝅶⁦⁦‪𛲢⁣‪⁠𛲣𝅺‪⁠⁨‪𛲡⁠‪𝅷𛲠‪⁩‪𝅵⁢‪⁠⁧‭‪𛲣𛲢‪⁠⁠‭‪⁠𛲢⁩‪𛲣⁧‪⁠‭𝅶‪⁡⁡⁦‪⁠𝅳𝅹𝅴`

Too obvious? How about now?

(()=>{ᅠ
`use strict⁠‪𝅹⁦‪⁡⁧⁢‪⁡⁣𝅶𝅶‪𛲠⁠‪⁠‭⁦‪𝅹‪⁤‪⁠𛲣⁠𛲣‪𛲡𝅵⁡‪⁠⁦𝅸‪⁨𛲢‪⁣𝅹‪⁠𛲠𛲢‪𛲡⁠‪⁡⁦𛲣‪𛲡𝅵‪⁣𝅸‪⁩𝅵⁠‪⁠𝅸‪⁡⁡𝅸𛲡‪⁩𝅶𛲠‪⁠𝅶⁦⁦‪𛲢⁣‪⁠𛲣𝅺‪⁠⁨‪𛲡⁠‪𝅷𛲠‪⁩‪𝅵⁢‪⁠⁧‭‪𛲣𛲢‪⁠⁠‭‪⁠𛲢⁩‪𛲣⁧‪⁠‭𝅶‪⁡⁡⁦‪⁠𝅳𝅹𝅴`
//regular code la la la
})()

Good thing use strict is only meaningful within " or '!

How it Works

Your message → pieroxy's Lempel-Ziv → code points10 → charactersinput alphabet delimited by 1st item

Encoding throws out repeat code points in the given alphabet.

Decoding throws out code points not in the encoding alphabet.

Why do this?

Why are Egyptian hieroglyphics valid javascript variable names?

The answer is don't think about it.