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

type-analyzer

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

type-analyzer

Infer types from columns in JSON

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3K
decreased by-43.58%
Maintainers
2
Weekly downloads
 
Created
Source

type-analyzer

Infer types from CSV columns.

Overview

This package provides a single interface for generating the datatype for a given row-column formatted dataset. We support the following datatypes:

  • Geo-JSON,
  • WKT Geometry,
  • Boolean,
  • Currency,
  • Percent,
  • DateTime,
  • Date,
  • Time,
  • Int,
  • Float,
  • Number,
  • Zipcode,
  • City,
  • String

Installation

npm install type-analyzer

Usage

Usage is super simple, simply call computeColMeta on your data like so

var Analyzer = require('type-analyzer').Analyzer;

var colMeta = Analyzer.computeColMeta(data);

But imagine you want to ensure that a column full of ids represented as numbers is identified as a column of strings, type-analyzer's got you. Simply pass an array of rules:

var Analyzer = require('type-analyzer').Analyzer;

var colMeta = Analyzer.computeColMeta(data, [{name: 'id', dataType: 'STRING'}]);
// or
var colMeta = Analyzer.computeColMeta(data, [{regex: /id/, dataType: 'STRING'}]);

Note: Analyzer prefers rules using name over regex since better performance.

And it will short cut around the usual analysis system and give you back the column formatted as you'd expect.

Update

Breaking changes with v1.0.0: Regex has moved into src, but can more easily be accessed from the module.exports from the root. As part of a larger clean up many extraneous util files were removed.

FAQs

Package last updated on 03 Jan 2019

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