JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q49193F
  • License MIT

IceTray is simple tool to transform raw data to schema, and sanitize data type

Package Exports

  • icetray

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (icetray) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

IceTray

IceTray is simple tool to transform raw data to schema, and sanitize data type

Getting Started

Installation

$ npm i icetray

Example

const IceTray = require('icetray');

// Create Data Schema
const CatSchema = {
  id: Number,
  name: String,
  age: Number
}

const rawData = {
  id: '12345',
  name: 'Garfield',
  age: '3',
  color: 'black'
}

const cat = IceTray(CatSchema, rawData)
/* 
  cat = {
    id: 12345,
    name: 'Garfield,
    age: 3
  }
*/

Simple Schema Design

Type Support
  • String return data type String
  • Number return data type Number
  • 'default' return raw data of key
const schema = {
  key1: String,
  key2: {
    type: String,
    default: 'Default Value',
    fields: ['map1', 'map2', 'map3']
  }
}