View Code? Open in Web Editor
NEW
High performance immutable lib alternative to immer with the same api, based on shallow copy on read and mark modified on write mechanism.
Home Page: https://tnfe.github.io/limu
License: MIT License
JavaScript 84.40%
TypeScript 15.60%
limu's People
limu's Issues
代码如下( 可访问 https://tnfe.github.io/limu/ 打开console复制并回车运行 )
// const { createDraft, finishDraft } = immer; // immer 结果ok
const { createDraft, finishDraft } = limu ; // limu 结果不正常
const base = {
list : [ { name :1 } , { name :2 } ] ,
map : { } ,
} ;
const draft = createDraft ( base , { onOperate : console . log } ) ;
const map = { } ;
draft . list . forEach ( item => {
map [ item . name ] = item ;
} ) ;
draft . map = map ;
const final = finishDraft ( draft ) ;
console . log ( 'base' , base ) ;
console . log ( 'final' , final ) ;
limu 结果:
immer 结果:
升级到1.0.11,bug已修复,感谢关注
不知道是不是写法的问题,sandbox中升级1.0.11后仍然未生效,甚至count的变化也不能触发被produce的数据更新视图
Originally posted by @itmanyong in #2 (comment)
package.json缺少module
字段和sideEffects
字段,无法进行摇树
package.json缺少exports
字段,next.js以及其它node12+环境恐怕无法使用。
推荐使用 tsup 打包
limu is short of love immutable, born for efficient creation and operation of immutable object, based on shallow copy on read and mark modified on write mechanism.
short for
: as a less long form of a word or name 参考
short of
: not having enough of something 参考
是否应该改为 limu is short for love immutable
?
如图所示:useLimu的更新不起作用,且在非useLimu的更新触发更新后,useLimu之前的更新才会在视图上呈现最新的值
cn perf
en perf
cn perf2
en perf 2