globalizejs/globalize

Validation (internal code): evaluate a single entrypoint API

Open

#362 opened on Dec 9, 2014

View on GitHub
 (4 comments) (0 reactions) (0 assignees)JavaScript (4,759 stars) (645 forks)batch import
help wanted

Description

Jörn raised this concern in https://github.com/jquery/globalize/pull/351#discussion_r21466383. Evaluate the pros and cons of this change.

Currently, no final dist/ have unused validations. So, it's important to determine how this change would affect that and how would it affect its final sizes.


src/currency.js @ header

@jzaefferer

Have you considered making this a single validate module that exports an object with multiple functions? Would help reduce the number of dependencies you need to require in many places, including these modules itself, since most share the same dependencies."

@rxaviers

Different methods require different validations. Therefore, the dependency of the validate functions across Globalize (core), date module, number module, plural module, etc are different.

How bundling all validations on a single export affect the final dist files? What the gain is?"

@jzaefferer

There are 103 effective LOC in common/validate, counting only the returned functions, excluding the define wrappers and blank lines. Grouping those 14 files into a single one with about 120 LOC would simplify dependencies in many places and improve the overall understandibility (I may have made that word up, I hope you catch my meaning).

It would also give the potential for other refactorings, as refactorings in general do, for example I suspect that some of the other modules in common are only used in the various validation modules.

Contributor guide