3 var assign, camelCase, capitalize, isArray, isEmpty, isFunction, isObject, isPlainObject, kebabCase, snakeCase, titleCase, words,
5 hasProp = {}.hasOwnProperty;
8 var i, key, len, source, sources, target;
9 target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
10 if (isFunction(Object.assign)) {
11 Object.assign.apply(null, arguments);
13 for (i = 0, len = sources.length; i < len; i++) {
17 if (!hasProp.call(source, key))
continue;
18 target[key] = source[key];
26 isFunction =
function(val) {
27 return !!val && Object.prototype.toString.call(val) ===
'[object Function]';
30 isObject =
function(val) {
32 return !!val && ((ref = typeof val) ===
'function' || ref ===
'object');
35 isArray =
function(val) {
36 if (isFunction(Array.isArray)) {
37 return Array.isArray(val);
39 return Object.prototype.toString.call(val) ===
'[object Array]';
43 isEmpty =
function(val) {
49 if (!hasProp.call(val, key))
continue;
56 isPlainObject =
function(val) {
58 return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor ===
'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));
61 words =
function(val) {
62 return (val.split(/[-_\s]+|(?=[A-Z][a-z])/) || []).filter(
function(n) {
67 camelCase =
function(val) {
68 var i, index, len, r, ref, word;
71 for (index = i = 0, len = ref.length; i < len; index = ++i) {
73 r += index ? capitalize(word.toLowerCase()) : word.toLowerCase();
78 titleCase =
function(val) {
79 var i, index, len, r, ref, word;
82 for (index = i = 0, len = ref.length; i < len; index = ++i) {
84 r += capitalize(word.toLowerCase());
89 kebabCase =
function(val) {
90 var i, index, len, r, ref, word;
93 for (index = i = 0, len = ref.length; i < len; index = ++i) {
95 r += (index ?
'-' :
'') + word.toLowerCase();
100 snakeCase =
function(val) {
101 var i, index, len, r, ref, word;
104 for (index = i = 0, len = ref.length; i < len; index = ++i) {
106 r += (index ?
'_' :
'') + word.toLowerCase();
111 capitalize =
function(val) {
112 return val.charAt(0).toUpperCase() + val.slice(1);
115 module.exports.assign = assign;
117 module.exports.isFunction = isFunction;
119 module.exports.isObject = isObject;
121 module.exports.isArray = isArray;
123 module.exports.isEmpty = isEmpty;
125 module.exports.isPlainObject = isPlainObject;
127 module.exports.camelCase = camelCase;
129 module.exports.titleCase = titleCase;
131 module.exports.kebabCase = kebabCase;
133 module.exports.snakeCase = snakeCase;
135 module.exports.capitalize = capitalize;
137 module.exports.words = words;