stephenplusplus/split-array-stream

split is not a function

stephenplusplus opened this issue · 3 comments

@JustinBeckwith I'm new here-- can we not just export the function, so that this is allowed?

const split = require('split-array-stream')
split(...)

With 2.0.0, we have to do:

const split = require('split-array-stream')
split.split(...)

Agh, I forgot about that. This is an issue with es modules as far as I can tell. In commonjs module land, you'd say:

const {split} = require('split-array-stream');

In es module land:

import {split} from 'split-array-stream';

I haven't found a way to get a default function export that's both es module and commonjs compatible using the old-school requires :( It's possible @MylesBorins knows a trick here I don't :)

I think that @ didn't work!

Oops :)