mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-11-14 10:50:04 -05:00
50 lines
1023 B
JavaScript
50 lines
1023 B
JavaScript
/*!
|
|
Copyright (c) 2015 Jed Watson.
|
|
Licensed under the MIT License (MIT), see
|
|
http://jedwatson.github.io/classnames
|
|
*/
|
|
|
|
(function () {
|
|
'use strict';
|
|
|
|
function classNames () {
|
|
|
|
var classes = '';
|
|
|
|
for (var i = 0; i < arguments.length; i++) {
|
|
var arg = arguments[i];
|
|
if (!arg) continue;
|
|
|
|
var argType = typeof arg;
|
|
|
|
if ('string' === argType || 'number' === argType) {
|
|
classes += ' ' + arg;
|
|
|
|
} else if (Array.isArray(arg)) {
|
|
classes += ' ' + classNames.apply(null, arg);
|
|
|
|
} else if ('object' === argType) {
|
|
for (var key in arg) {
|
|
if (arg.hasOwnProperty(key) && arg[key]) {
|
|
classes += ' ' + key;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return classes.substr(1);
|
|
}
|
|
|
|
if (typeof module !== 'undefined' && module.exports) {
|
|
module.exports = classNames;
|
|
} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd){
|
|
// AMD. Register as an anonymous module.
|
|
define(function () {
|
|
return classNames;
|
|
});
|
|
} else {
|
|
window.classNames = classNames;
|
|
}
|
|
|
|
}());
|