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 🙏

© 2025 – Pkg Stats / Ryan Hefner

test-and-convert-types

v1.0.1

Published

test time

Readme

test-and-convert-types

Library that has two main functions:

  • Test the execution time of functions and Test according to the time requested by you in milliseconds.
  • Decode and encondify binary, text, and numeric type data.

Installation

npm i test-and-convert-types

Usage

Test

  • Calculate the execution time of a function.
const { test } = require('test-and-convert-types');

// Test the execution time of a function
function helloworld(a, b) {
  console.log(a + b);
}
console.log(test.testTimeCount(helloworld));
// Output:
// 🕑:0.039
  • With time check
// Test the execution time of a function with a parameter and validate the result

function helloworld(a, b) {
  console.log(a + b);
}

console.log(test.testTimeCheck(helloworld, 0.1));
// Output:
// ✅ Test completed, great time

console.log(test.testTimeCheck(helloworld, 0.004));
// Output:
// ❌ Failed Test, time exceeded to 0.004 ms
  • Compare performance with other functions
// Compare the execution time with other functions

function helloworld(a, b) {
  console.log(a + b);
}
function helloworld2(a, b) {
  console.log(a + b);
}

console.log(test.testTimeFunctions(helloworld, helloworld2));
// Output:
// Function primary with: 🕑 :0.035 ms, performs better than function secondary with: 🕑 :0.003 ms

Decode

const { decode } = require('test-and-convert-types');

//Convert a Binary to a number
const num = convert.binaryToNumber("11001")
console.log(num)
// Output:
// 25

//Convert a Binary to a Text
const text = convert.binaryToText("0110002")
console.log(text)
// Output:
// ↑

// Decode a Token Jwt to a Object
const token = convert.decodeJwt("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c")

console.log(token)
// Output:
// { sub: '1234567890', name: 'John Doe', iat: 1516239022 }

// convert a Number to a Binary
const binary = convert.numberToBinary(20)

console.log(binary)
// Output:
// 10100

// convert text to base64
const b64 = convert.textToB64('Hola Mundo');

console.log(b64)
// Output:
// SG9sYSBNdW5kbw==

// convert text to binary
const textBinary = convert.textToBinary('Hola mundo');

console.log(textBinary)
// Output:
// 1001000 1101111 1101100 1100001 100000 1101101 1110101 1101110 1100100 1101111

If you want to support me, you can contact me.

If you liked it you can give it a ⭐ in the repository, that would help me a lot.

Version

1.0.1

Author

Andy Santisteban

License

MIT