Separate main.js into some modules.

Helper functions and the plugin function are separated.
This commit is contained in:
Hyunje Alex Jun
2015-02-11 15:53:40 +00:00
parent d54c7d6640
commit 339e478674
4 changed files with 896 additions and 862 deletions
+36
View File
@@ -0,0 +1,36 @@
/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
* Licensed under the MIT License
*/
'use strict';
exports.toInt = function (x) {
if (typeof x === 'string') {
return parseInt(x, 10);
} else {
return ~~x;
}
};
exports.isWebKit = 'WebkitAppearance' in document.documentElement.style;
exports.clone = function (obj) {
if (obj === null) {
return null;
} else if (typeof obj === 'object') {
var result = {};
for (var key in obj) {
result[key] = this.clone(obj[key]);
}
return result;
} else {
return obj;
}
};
exports.extend = function (original, source) {
var result = this.clone(original);
for (var key in source) {
result = this.clone(source[key]);
}
return result;
};