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

encodify

v0.2.4

Published

convert to popular formats

Downloads

37

Readme

Encodify Build Status

Join the chat at https://gitter.im/npkumar/encodify

A small library providing utility methods to encode and decode to various code formats

NPM

Installation

npm install encodify --save

Usage

var encodify = require('encodify');

// Convert to Pig Latin Script
encodify.toPigLatin('glove').should.eql('oveglay');

// Convert to Roman Numeral
encodify.toRomanNumeral(55).should.eql('XXXXXV');

// Convert to NATO Code - French and German currently supported
encodify.toNATOCode('CODE').should.eql('Charlie Oscar Delta Echo');
encodify.toNATOCode('code', 'German').should.eql('Cäsar Otto Dora Emil');
encodify.toNATOCode('C.O D@E', 'FRENCH').should.eql('Célestin point Oscar espace Désiré arobase Eugène');

// Convert to Morse Code
encodify.toMorseCode('secret').should.eql('... . -.-. .-. . -');
encodify.toMorseCode('b.o@nd').should.eql('-... .-.-.- --- .--.-. -. -..');
encodify.toMorseCode('NPK').should.eql('-. .--. -.-');

// Convert from Morse Code
encodify.fromMorseCode('... . -.-. .-. . -').should.eql('secret');
encodify.fromMorseCode('.... .- .--. .--. -.-- -..-. -... .. .-. - .... -.. .- -.-- -..-. -. .--. -.-').should.eql('happy/birthday/npk');

// Convert to Binary Code
encodify.toBinary('I am the War Cheif!').should.eql('1001001 100000 1100001 1101101 100000 1110100 1101000 1100101 100000 1010111 1100001 1110010 100000 1000011 1101000 1100101 1101001 1100110 100001');
encodify.toBinary('&#@!').should.eql('100110 100011 1000000 100001');
encodify.toBinary(9).should.eql('111001');

// Convert from Binary Code
encodify.fromBinary('1001001 100000 1100001 1101101 100000 1110100 1101000 1100101 100000 1010111 1100001 1110010 100000 1000011 1101000 1100101 1101001 1100110 100001').should.eql('I am the War Cheif!');
encodify.fromBinary('100110 100011 1000000 100001').should.eql('&#@!');
encodify.fromBinary('111001').should.eql('9');

// Convert to list of Anagrams
encodify.toAnagrams('cod').should.eql(['cod', 'cdo', 'ocd', 'odc', 'dco', 'doc']);
encodify.toAnagrams('%*!').should.eql(['%*!', '%!*', '*%!', '*!%', '!%*', '!*%']);

// Convert to Spinal Case
encodify.toSpinalCase('thisIsSpinalTap').should.eql('this-is-spinal-tap');
encodify.toSpinalCase('This Is Spinal Tap').should.eql('this-is-spinal-tap');
encodify.toSpinalCase('The_Andy_Griffith_Show').should.eql('the-andy-griffith-show');

// Convert to Fibonacci Series
encodify.toFibonacci(10).should.eql([ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 ]);
encodify.toFibonacci(3.9).should.eql([ 1, 1, 2 ]);

// Convert to Base DNA Pair
encodify.toDNABasePair('GGCC').should.eql('CCGG');
encodify.toDNABasePair('GaTcAatagc').should.eql('CTAGTTATCG');

// Convert to list of Prime numbers upto given specified number
encodify.toPrimes(10).should.eql([2, 3, 5, 7]);
encodify.toPrimes(30.97).should.eql([2, 3, 5, 7, 11, 13, 17, 19, 23, 29]);

// Calculate LCM of all values in an array
encodify.toLCM([330, 65, 15]).should.eql(4290);
encodify.toLCM([330, 90, 65, 55, 20, 15]).should.eql(25740);

// Calculate GCD of all values in an array
encodify.toGCD([45, 60, 330]).should.eql(15);
encodify.toGCD([25, 45, 60, 115, 330]).should.eql(5);

// Convert to flattened array from any multi dimensional array of varying level of nesting
encodify.toFlattenedArray([1, [], [3, [[4]]]]).should.eql([1, 3, 4]);
encodify.toFlattenedArray([1, [5, [6, [7, 8, [9]]]], [3, [[4]]]]).should.eql([1, 5, 6, 7, 8, 9, 3, 4]);

Tests

npm test

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code. Feel free to add more conversions!

Release History

  • 0.1.0 Initial release