Common utilities for JavaScript.
This is Noah's Ark for Atwood's Law: "any application that can be written in JavaScript, will eventually be written in JavaScript." 😂
##Installations
git remote add -f util-js git@github.com:idf/commons-util-js.git
git subtree add --prefix [dir/]util-js util-js develop --squash
git subtree pull --prefix [dir/]util-js util-js develop --squash
git subtree push --prefix [dir/]util-js util-js develop
###Common Utils for Everything
<script type="text/javascript" src="/js/commons-util-js/DomUtils.js"></script>
<script type="text/javascript" src="/js/commons-util-js/PrimitiveExtensions.js"></script>
####Dependencies
- JQuery
- JQuery-UI
###Common Utils for AngularJS
<script type="text/javascript" src="/js/commons-util-js/angularjs/filters.js"></script>
####Dependencies
- AngularJS
##Friends
###JSHint
JetBrains configuration - opt for using config files .jshintrc
.
##Best Practice for JS Folder Structure ref
www/
index.html
js/
app/
sub.js
lib/
jquery.js
canvas.js
app.js
require.js
(function(){
/* code */
}());
// And that's the way if some parameters shall be passed
(function(a, b){
/* code */
})(arg1, arg2); //arg1 -> a; arg2 -> b
- Prefer function delectation than anonymous function (function expression), because of facilitation of hoisting.
- Prefer anonymous function to be one-line.
##CSS/JS Dependencies Do not commit 3rd party/ventor CSS/JS. Use bower.json to update dependencies instead Initialize bower
bower init
Update dependencies:
bower update