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

datadance

v1.0.1

Published

DataDance is a versatile data processing package that makes handling JSON transformations straightforward and efficient. Our package accepts JSON input and allows you to define transformations using a code-like format. Provide your data and transformation

Downloads

85

Readme

DataDance is a versatile data processing package that makes handling JSON transformations straightforward and efficient. Our package accepts JSON input and allows you to define transformations using a code-like format. Provide your data and transformation rules, and DataDance will process them to deliver the desired output.

Install

Install DataDance from npm:

npm install datadance

Then you can import it in your code :

import { transform } from "datadance";

or

const datadance = require("datadance");
const transform = datadance.transform;

You can use the transform method :

async function test() {
    var res = await transform({
        input: { x: 2 },
        transforms: [{ x: "input.x+8" }],
        settings: {
            merge_method: "overwrite",
        },
    });
    console.log(res); // { x : 8 }
}
test();

Local Setup

  • Datadance uses Deno, so you need to install Deno in your local.
    • On Linux :
      curl -fsSL https://deno.land/install.sh | sh
    • On Windows :
      irm https://deno.land/install.ps1 | iex
  • Clone the Datadance repo locally :
    git clone https://github.com/yakshavingdevs/datadance.git && cd datadance
  • And then start the server :
    deno task start
  • Then you can either play with the API http://localhost:8000/process or experience playground http://localhost:8000/design/build.

Where Datadance Shines?

In many ETL pipeline scenarios, executing third-party or user-provided code can be both an operational and security challenge. Managing and isolating this code often becomes a complex task. DataDance solves this problem by offering a unique solution where third-party or user logic is expressed as DataDance transforms. These transforms are easy to maintain and eliminate the need for a traditional programming language shell. Internally, DataDance uses a parser that executes the specified transforms on the input JSON and produces an output JSON, ensuring both simplicity and security.

Internals

  • Parser & Evaluation Engine : Datadance at its core uses MozJexl expression language. We can use expression language to parse a given expression and evaluate it.
  • Backend : Deno + Fresh
  • Frontend: Preact + Bootstrap + Ace Editor

CLI

  • Compiling the binary :
    deno task compile # builds the binary
  • Executing the binary :
    ./bin/datadance -i '{"hello": "world"}' -t '[{"also": "\"hello \" + input.hello"}]' -s '{"merge_method": "overwrite"}'
    

Expression language reference

Example

  • You can make POST call to the http://localhost:8000/process with below JSON :
    {
      "input": {
        "name": {
            "first": "Malory",
            "last": "Archer"
        },
        "exes": [
            "Nikolai Jakov",
            "Len Trexler",
            "Burt Reynolds"
        ],
        "lastEx": 2
      },
      "transforms": [
        {"lastEx": "input.lastEx + 5"}
      ],
      "settings": {
        "merge_method": "overwrite"
      }
    }
  • And the output will be :
    {
        "name": {
            "first": "Malory",
            "last": "Archer"
        },
        "exes": [
            "Nikolai Jakov",
            "Len Trexler",
            "Burt Reynolds"
        ],
        "lastEx": 7
    }

Contributing

Development of Datadance happens in the open on GitHub. You can read the contributing guide here : CONTRIBUTING.md.

License

MIT