Dayjs: ideas about saving some bytes

Created on 21 May 2018  路  15Comments  路  Source: iamkun/dayjs

Most helpful comment

rollup-plugin-uglify plugin will help us do this , and we already using this in build/rollup.config.js.

i think write code like this may not necessary and will made someone that don't know void 0 === undefined hard to understand this code.

code in dayjs.min.js
img

All 15 comments

Sounds interesting, any detailed information please?

Good idea to write it in less amount of symbols:

-const isUndefined = s => s === undefined
+const isUndefined = s => s === void 0

yes, it's shorter than undefined and save a little bytes 馃榿

Why closing? @a13821190779

I thought you probably got it, so. . .

I had some ideas about saving some bytes.. example:

-return Utils.padStart(this.$H < 13 ? this.$H : this.$H - 12, match === 'hh' ? 2 : 1, '0')
+return Utils.padStart(this.$H < 13 ? this.$H : this.$H - 12, match.length, '0')

Let me investigate it when I will have free time ;)

@a13821190779 but we need to merge it, of course. Can you open PR?)

ok @Imperat
and I will continue to pay attention and make good suggestions. :)

This is an interesting topic and I've change the title a little bit.

oh, a great idea. @a13821190779

@huruji 鍝堝搱

rollup-plugin-uglify plugin will help us do this , and we already using this in build/rollup.config.js.

i think write code like this may not necessary and will made someone that don't know void 0 === undefined hard to understand this code.

code in dayjs.min.js
img

@guisturdy Just noticed your comment after merged that PR.

Yes, seems we don't have to do it.

undefined is not save, and can be modified .
void 0 alwalys equal to the undifined : assert(typeof (void 0) === 'undeifned)

great discussion

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fundon picture fundon  路  5Comments

oliv9286 picture oliv9286  路  4Comments

Wyzix33 picture Wyzix33  路  4Comments

LauRocky picture LauRocky  路  5Comments

paraself picture paraself  路  3Comments