-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
About
Now package has almoust a 6kb size. We can add small changes and make named imports and plugin style.
It can reduce bundle size at client side for 2-3kb (Profit!)
Changes:
config func (at and):
...
// Inject plugins to Decimal prototype
Object.entries(plugins).forEach(([name, plugin]) => {
this.prototype[name] = plugin
})
return this;
}
write all public func as named exports:
export default Decimal;
export {
absoluteValue, absoluteValue as abs,
dividedBy, dividedBy as div,
...
}
user code:
import Decimal, { abs, log, toNumber, ... } from 'decimal.js-light/plugins';
Decimal.config({
plugins: {
abs, log, toNumber
}
})
Standard (all) funcs: 5.8 kB
Plugin version: from 2.37 kB (main import with mini-funcs)
mini-funcs (one-lines or without external funcs) can be includes by default (wiill be base version from ~2.5 kB)
lets discuss
Metadata
Metadata
Assignees
Labels
No labels