Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议:改进对于未填的格子的处理方式,以便更灵活和更精简尺寸 #49

Open
SkyKn1ght opened this issue Oct 11, 2021 · 0 comments

Comments

@SkyKn1ght
Copy link

发现当前版本 v1.4 ~ 1.4.3 的处理都是若有未填的格子时:
string 类型自动填为 "" (0长度字符串), number类型自动填为 0.0 , boolean 类型自动填为 false

建议规则改为,若有未填的格子时,无论指定是什么类型,都不如直接 剃除这对 key-value 项。

这样至少有两个明显好处:
1 若是不用这些格数据,可以故意不填,这样处理可以明显减少json文件的尺寸
2 便于使用者自己实现默认值功能,等于是用 undefined作为默认值标记——可以故意不填一些格子,运行时可以代码检测读到的值是否 undefined 然后替换成自己约定的指定默认值

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant