Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datamap

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datamap

Define abstract interfaces around datasets

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

DataMap

A library for defining an abstract interface around datasets (alternatively: a well-intentioned attempt to simplify d3.chart).

browser support

Usage

This utility allows library authors to define an abstract "shape" for datasets. Library consumers may have datasets that conform to a different structure. They can use this data directly if they provide a "mapping" function.

// (library code: setup)
// Create a datamap with the abstract attribute names:
  // ...
  this.dm = new DataMap(['time', 'space']);
  // ...

// (consumer code: configuration)
// Define a mapping that translates the abstract attribute names to the names
// that fit your data:
Library.dm.map({
  time: function() { return this.tiempo; },
  space: function() { return this.espacio; }
});

// (consumer code: data specification)
// Supply your dataset to the library
Library.draw([ { tiempo: 23, espacio: 45 } ]);

// (library code: dereferencing)
// Wrap incoming data to normalize its "shape":
  draw: function(userData) {
    var normalized = this.dm.wrap(userData);
    normalized.time; // => 23
    normalized.space; // => 45
  }

License

Copyright (c) 2013 Mike Pennisi
Licensed under the MIT license.

Keywords

FAQs

Package last updated on 01 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc