Separate main.js into some modules.
Helper functions and the plugin function are separated.
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user