mesqueeb / is-what

JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.
https://mesqueeb.github.io/is-what/
MIT License
170 stars 18 forks source link

Expose individual files as exported files #81

Closed jcbhmr closed 1 month ago

jcbhmr commented 11 months ago

Basically add this to package.json

{
  "exports": {
    ".": "./dist/index.js",
    // In addition to ☝
    "./*.js": "./dist/*.js"
  }
}

to allow:

import { isObject } from "is-what/isObject.js"

or if we used default exports

import isObject from "is-what/isObject.js"

this is in the spirit of keeping the package as light as possible. This way, even if your target environment doesn't do bundling/tree-shaking, you can still manually "treeshake" in your code to only import what's needed.

cc @mesqueeb is this a good idea?

jcbhmr commented 11 months ago

This is actually one of the reasons I wanted #57 😅