https://github.com/idf/commons-util-js
Common utilities for JavaScript
https://github.com/idf/commons-util-js
Last synced: 3 months ago
JSON representation
Common utilities for JavaScript
- Host: GitHub
- URL: https://github.com/idf/commons-util-js
- Owner: idf
- License: apache-2.0
- Created: 2015-02-02T05:04:30.000Z (over 11 years ago)
- Default Branch: develop
- Last Pushed: 2016-07-22T23:41:32.000Z (almost 10 years ago)
- Last Synced: 2025-10-25T02:04:50.949Z (8 months ago)
- Language: HTML
- Size: 112 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Common JavaScript Utils() {
Common utilities for JavaScript.
This is Noah's Ark for [Atwood's Law](http://blog.codinghorror.com/the-principle-of-least-power/): "any application that can be written in JavaScript, will eventually be written in JavaScript." :joy:
##Installations
### As Git Subtree
```
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
```html
```
####Dependencies
* JQuery
* JQuery-UI
###Common Utils for AngularJS
```html
```
####Dependencies
* AngularJS
##Friends
* [JSHint](http://jshint.com/) for code quality.
* [Bower](http://bower.io/) for package management.
###JSHint
JetBrains configuration - opt for using config files `.jshintrc`.
##Best Practice for JS Folder Structure
[ref](http://requirejs.org/docs/api.html)
```
www/
index.html
js/
app/
sub.js
lib/
jquery.js
canvas.js
app.js
require.js
```
## Immediately Invoked Function Expression (IIFE)
```javascript
(function(){
/* code */
}());
// And that's the way if some parameters shall be passed
(function(a, b){
/* code */
})(arg1, arg2); //arg1 -> a; arg2 -> b
```
## Functions
* 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
```bash
bower init
```
Update dependencies:
```bash
bower update
```
# };