ZHAO Jin-Xiang

Results 94 comments of ZHAO Jin-Xiang

> It could be ambiguous, though. ```ts // here there are two different parameters called "success" export type OnEnter = ((success: boolean) => void) | ((success: ISuccessCode, details: string) =>...

https://github.com/nbubna/Case/blob/7f054b03aa32b73bd78c28ca7218b1ea8ca78554/src/Case.js#L169-L173 Can we change the source code to esm and package it into umd and esm?

I can provide a PR containing umd, esm with rollup.This will not be very complicated.

I am a [vite](https://github.com/vitejs/vite) user. Currently, vite only supports esm, which drives us to provide esm support to all community libraries.

@nbubna Please review it. TODO: simplify codes to support tree shaking for downstream users.

```js Case.type('bang', function(s) { return Case.upper(s, '!')+'!'; }); ``` This usage is very dynamic, esm can only be exported statically. Static export can make rollup and webpack tree shaking more...

If we continue to use esm, it is difficult for us to achieve API compatibility, because esm can only be exported statically. Maybe we can define an object named case...

```js import * as _ from './utils.mjs'; import * as types from './types.mjs'; const typesArray = Object.keys(types); function of(s) { for (var i = 0, m = typesArray.length; i <...

```js // TODO: can't export these // export {of,flip,random,type,utils as _ }; // export * from './types.mjs'; export default Case; ``` If we `export default Case` with export other functions....

The static nature of esm makes it inconvenient for us to dynamically inject on the module. I also think `Case.of` and `Case.type` are not particularly useful.