mastodon.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
The original server operated by the Mastodon gGmbH non-profit

Administered by:

Server stats:

379K
active users

Imports question. I'm using a library (npmjs.com/package/indefinite) where I can do this:

import * as indefinite from 'indefinite';
console.log(indefinite.default('apple'));

The default part 'feels' wrong to me. Is there a better way to import that?

It works though so... deal with it?

npmindefinitePrefix a noun with an indefinite article - a or an - based on whether it begins with a vowel. Latest version: 2.5.1, last published: a month ago. Start using indefinite in your project by running `npm i indefinite`. There are 36 other projects in the npm registry using indefinite.

@raymondcamden Probably about as elegant as you’re going to get if you do need to import everything from the module

@aral i used @sirlan's example - worked great :)

@raymondcamden But won’t that only import default? If you’re going to do that why not just do:

import a from ‘indefinite’

(Or am I missing something?) :)

@aral it worked, thats all i know :)

went with: import { default as ind } from 'indefinite';

and ind(...) works fine.

@raymondcamden Ah right, if the default export is all you need, the line I gave you should work too and it’s a bit more common :)

In this case:

import ind from ‘indefinite’

Raymond Camden

@aral ah... so we dont need the as X part as default is... well default.

right thinking there?