typemy

Get the type of each value in an object

Usage no npm install needed!

<script type="module">
  import typemy from 'https://cdn.skypack.dev/typemy';
</script>

README

typemy

Build Status

Install

npm install typemy

Usage

const typemy = require("typemy");

const object = {
  a: "string",
  b: 2,
  c: [],
  d: {
    i: Symbol("sym"),
    ii: null,
    iii: undefined,
    iv: {}
  },
  e: () => {},
  f: new Error("err!!!")
};

const typedObject = typemy(object);
console.log(typedObject);
/*
  { a: 'String',
    b: 'Number',
    c: 'Array',
    d: {
      i: 'Symbol',
      ii: 'Null',
      iii: 'Undefined',
      iv: 'Object'
    },
    e: 'Function',
    f: 'Error' 
  }
*/

License

MIT © wmik