littleball-games / lb-f

A collection of functional programming functions
MIT License
0 stars 1 forks source link

Moved files around to make growth easier #3

Closed Eruant closed 6 years ago

Eruant commented 6 years ago

Firstly each function has been moved to it's own file. This will allow simpler editing should the number of functions increase

Secondly the tests have been moved next to each file. This makes it easier to notice when a test is missing, and allows you to find the test quicker.

skylize commented 6 years ago

I like this idea. Allows partial imports without tree shaking.

skylize commented 6 years ago

Not a huge fan of the f. prefixes. I think it makes usage less intuitive. This looks awkward:

import curry from 'lb-f/f.curry'

Also, for consistency, maybe use named exports for submodules too. So usage like this:

import { curry } from 'lb-f/curry'
Eruant commented 6 years ago

We can loose the f prefixes.

@skylize If we were to use named exports for the submodules, how would you suggest we expose named exports to the main package?

skylize commented 6 years ago

@Eruant The main package can also import with destructuring.

import { curry } from './curry'
Eruant commented 6 years ago

@skylize It wasn't the import I was worried about. It was allowing an export, but that can be done with export {curry} if I'm reading the docs correctly.

skylize commented 6 years ago

Oh. I see. Yeah, you can actually skip the import entirely in the main entry and export directly from the underlying file like this:

export { curry } from './curry.mjs'

or maybe it's this, can't quite remember:

export const { curry } from './curry.mjs'
skylize commented 6 years ago

Actually I like what you did here, exporting on default too :+1:

Eruant commented 6 years ago

@skylize It's good to know about exporting directly. I may use that in future.