-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
Basically You're adding quite a lot of kilobytes to the lib by using lodash, uncompressed it can reach a 1mb.
https://github.com/vuedev-com/vue-localize/blob/master/src/vue-localize.js#L1
Add something like this to lib/utils.js, to replace lodash.get
export function get (obj, notation, defaultValue) {
return notation.split('.')
.reduce( (key) => obj[key], obj) || defaultValue;
}Then replace :
replace(str, foo, bar) with : str.replace(foo, bar)
each(collection, (key, value) => foo(key, value) ) with :
const helpers = { translate };
Object.keys(helpers)
.forEach( (name) => {
Vue.filter(name, helpers[name]);
Vue.prototype['$' + name] = helpers[name];
});you can use https://github.com/joakimbeng/kebab-case in place of lodash.kebabcase
The story is that through experience and pain, I've learnt to avoid using lodash, underscore, except when writing CLI tools or server side code
ijse, Saymon-biz and probil