two.js icon indicating copy to clipboard operation
two.js copied to clipboard

Make Two.Utils private?

Open adroitwhiz opened this issue 5 years ago • 4 comments

Currently, there's a lot of stuff in Two.Utils that was copied in from Underscore.

It looks like some work has already been put into reducing the use of Underscore in Two.js, but Two.Utils could be further cut down and maybe made private so that it can change to suit Two.js' needs without worries of breaking external code which relies on it.

This would break any Two.js projects currently using public Two.Utils functions, so perhaps it would be a good candidate for 0.8.0?

adroitwhiz avatar Dec 05 '19 16:12 adroitwhiz

I think this is a good idea. What in your mind could be further cut down? I think in some ways this is symptomatic of a larger issue which I think ES6 Modules would fix.

jonobr1 avatar Dec 06 '19 15:12 jonobr1

A lot of the "is" functions (isUndefined, isNumber, isString, etc.) can be replaced with typeof checks.

In addition, there are certain functions like values (and several "is" functions) that are never used in the codebase, and functions like map, each, bind, and isArray that can be replaced with native methods.

adroitwhiz avatar Dec 06 '19 18:12 adroitwhiz

I've done some work in this branch

adroitwhiz avatar Dec 06 '19 19:12 adroitwhiz

Cool, I'll keep on eye on that branch!

jonobr1 avatar Dec 07 '19 14:12 jonobr1