JSPM

@ibnlanre/objectify

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q50093F
  • License MIT

A utility for converting JS reference types to objects

Package Exports

  • @ibnlanre/objectify

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 (@ibnlanre/objectify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

objectify

A utility for converting a JS reference type to an object

Install

npm i @ibnlanre/objectify

Import

// Browser
<script src="https://unpkg.com/@ibnlanre/objectify"></script>;

// ES6 Import
import objectify from "@ibnlanre/objectify"

// NodeJS Require
const objectify = require("@ibnlanre/objectify");

API

objectify(item [, callbackFn [, thisArg]])

Usage

objectify(5) // {}

// callbacks should return an array
const cb = ([value, key], index, item) => [index, value]

// { 0: 6, 1: 8, 2: 90 }
objectify(new Set([6, 8, 90]), cb)

// {  0: "zero", 1: [4, 5, 6] }
objectify(new Map([[0, "zero"], [1, [4, 5, 6]]]))

// { 0: "h", 1: "e", 2: "l", 3: "p" }
objectify("help")