Proposal: Discarding specific element when importing/re-exporting module

# Sm In (25 days ago)

Proposal: except clause in ModuleItem

Inspired by [Haskell’s import statement](,

Concept Introduction

Let’s say we have module A:

// A.js
export const zero = 0;
export const one = 1;
export const two = 2;
export const three = 3;
export const four = 4;
// … 
export const ten = 10;

A has so many exported values. Now Let’s say we want to re-export numbers between 0 to 9 in module B.

// B.js
export { zero, one, two, three, four, five, six, seven, eight, nine } from ‘./A.js’;

Hmmm, This is too long to see, isn’t it? How can we reduce this long, long export declaration? “Exporting numbers between 0 to 9 in module B” is same statement as “Exporting everything except ten from module B”. So, what if we can rewrite export declaration above like this?:

export * except { ten } from ‘./A.js’;

This would be not only simpler way but also shorter way.

Uses cases

When dealing with module that has too many exports to explicitly specify. I.e when using Util libraries or functional programming libraries like ramda, lodash, fp-ts and etc.

Non-Formal shapes

Import * except { elements… } from ‘module’;

Export * except { elements… } from ‘module’;
# Cyril Auburtin (19 days ago)

It's also possible to split that large 'A' file in 2, and have a possible third file merging them

export * from './numbers.js'
export * from './A-without-numbers.js'