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

orbit-encoder

v2.1.0

Published

ORBIT-ENCODER is an utility library for Data Compression and Encoding. It can take whatever object you give him as argument and returns a compressed encoded string. It provides a decoding method too. It uses a modified version of LZString for UTF16 Compre

Downloads

169

Readme

🟢 ORBIT ENCODER ⚙️🗜️

Compatible Status Code Size Status Commit Status Issues Status npm version license

ORBIT-ENCODER is an utility library for Data Compression and Encoding. It can take whatever object you give him as argument and returns a compressed encoded string. It provides a decoding method too. It uses a modified version of LZString for UTF16 Compression.


📚 Table Of Contents 📑


💨 What is this Library for? 🤔

ORBIT-ENCODER is a small library that is useful for Encoding Objects [String, Arrays, JSON, Anything...] to a Compressed UTF16 String. You can also Decode that string back using The exposed Decode method.

Note: This library can only be used with JS or TS but you already know that 🤦🏿‍♂️.

✨ Key Features 🎯

  • Use it without Instanciation because all the methods are Static.
  • Fast and High Performance Compression of big Complex Data.
  • ✅ TOO EASY TO USE !! 🥳🥳

📥 HOW TO RUN IT ? 🔰

# installation with npm
npm install array-querier

# or you may prefer
npm i --save array-querier

# installation with yarn
yarn add array-querier

This SCRIPT relies on NOTHING SO YOU DON'T NEED ADDITIONNAL PACKAGES.


🤔 HOW IT WORKS ? 🤔

You only need to Import the OrbitEncoder Class from the Package and start using it !

➤ Encode & Decode Given Data 🟢

If you have a User object as follows ->

const User = {
    "name": "Orbit",
    "age": 21,
    "planet": {
        "id": 4,
        "codename" : "Shadow-Coders",
        "galaxyName" : "Turner"
    }   
}

👇🏾 Let's Encode and Decode an Objects :

  • ECMAScript Modules and Typescript
    import {OrbitEncoder} from 'orbit-encoder/lib/OrbitEncoder';

    // Then Encode whatever you want
    const encodedData = OrbitEncoder.encode(User);

    console.log(encodedData);
    /**
     * 👇🏾 Output: 👇🏾
     * 
     * ᓢ㰴䅼ী甤〦恩Ìߐዠᔣᣡ䂦TɈ〦⁐䰠ᘡ㐢〪僠㲪␠祶fĂ࢕⓸Ǹ͚ࣣគⵉM䀼䀻什䁕㒘攈ᢸ᣷吰ৣ乩厖亰æၩ䩴¸椮ࠢ昤怪挑䃒塐恬睂⑘䤣&㉀PƘ䀠
     * 
     * /
    ...
    const decodedData = OrbitEncoder.decode(encodedData);

    console.log(decodedData);
    /**
     * 👇🏾 Output: 👇🏾
     * 
     * {
        name: 'Orbit',
        age: 21,
        planet: { id: 4, codename: 'Shadow-Coders', galaxyName: 'Turner' }
      }
     * 
     * /

🛑 ANGULAR & FRONTEND USERS ☢️

Note: If you are using this in your frontend application you'll need to add the folowing line in your index.html 👇🏾:.

    <script> if (global === undefined) { var global = window; } </script>

FIX COMING: We are working on Future updates that will try to fix this error [Uncaught ReferenceError: global is not defined].

  • CommonJs and Vailla JS
  const orbit = require("orbit-encoder").OrbitEncoder;

  const data = orbit.encode('Bodio Bodio Yei !!');

  console.log(data); // 🚀 Output :ᅢ汇njࢀ甠瀼橪梸恕<Ұᡠ⢠ୀ

  console.log(orbit.decode(data));

⚠ Note: ⚠ * You can do that : const orbit = require("orbit-encoder"); And use orbit.OrbitEncoder.encode() everywhere but for a more clean approach I did the code above.

➤ Encode & Decode Data Passed on URI 🟢

Sometimes you may want to pass some heavy and complex data or datastructure in a URL, so you can use the encodeWithURIsafe method. It produces ASCII strings representing the original string encoded in Base64 with a few tweaks to make these URI safe. Hence, you can send them to the server without thinking about URL encoding them. This saves bandwidth and CPU.

  • ECMAScript Modules and Typescript
    import {OrbitEncoder} from 'orbit-encoder/lib/OrbitEncoder';

    const data = [['2021-03-02','2021-06-02'],['2022-05-05','2021-07-01']];

    // Then Encode whatever you want
    const encodedData = OrbitEncoder.encodeWithURIsafe(data);

    console.log(dataForURI);

    /**
     * 👇🏾 Output: 👇🏾
     * 
     * OoRgzglgsgVgggTygZQAwHcoI1CBJMPGPTGAUQBcoARATSurwgA1kAPAIyJNjwYFUBEADIBhPEkZthAFTgBmWXDZ4ANiAAmQA
     * 
     * /
    ...
    const decodedData = OrbitEncoder.decodeURIsafe(encodedData);

    console.log(decodedData);
    /**
     * 👇🏾 Output: 👇🏾
     * 
     * [ [ '2021-03-02', '2021-06-02' ], [ '2022-05-05', '2021-07-01' ] ]
     * 
     * /
  • CommonJs and Vanilla JS
  const orbit = require("orbit-encoder").OrbitEncoder;


  const dataForURI = orbit.encodeWithURIsafe([['2021-03-02','2021-06-02'],['2022-05-05','2021-07-01']]);

  console.log(dataForURI) // 🚀 Output : OoRgzglgsgVgggTygZQAwHcoI1CBJMPGPTGAUQBcoARATSurwgA1kAPAIyJNjwYFUBEADIBhPEkZthAFTgBmWXDZ4ANiAAmQA
  
  console.log(orbit.decodeURIsafe(dataForURI))

Configuration Options

Coming Soon !


Contributing ❤

👋🏾 Pull requests are welcome!


Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.


GREETINGS


Author

Orbit Turner


License

This project is licensed under the MIT license. See the LICENSE file for more info.


❤ MADE WITH LOVE ❤

Image of OT