Package Exports
- parse-import-specifiers
- parse-import-specifiers/lib/parse-import-specifiers.js
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 (parse-import-specifiers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
parse-import-specifiers 
Parse ImportSpecifiers to 3 arrays according to type.
Reasoning
There is 3 types of ImportSpecifiers:
import test from 'supertape';import * as test from 'supertape';import {stub} from 'supertape';So:
- ☝️ When you generate code you should remember that after code transformations
ImportDefaultSpecifiercan be not at the begining of an array. - ☝️ When you check specifiers to destructure you should distinguish Import Specifiers from each other to determine what to do next.
Install
npm i parse-import-specifiersAPI
const {
defaults,
namespaces,
imports,
} = parseSpecifiers(specifiers);
for (const spec of defaults) {}
for (const spec of namespaces) {}
for (const spec of imports) {}License
MIT