Skip to content

Commit

Permalink
Freeshly built by webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
flasd committed Jan 13, 2018
1 parent 393765e commit e3be4d5
Showing 1 changed file with 121 additions and 164 deletions.
285 changes: 121 additions & 164 deletions dist/react-classlist-helper.js
Original file line number Diff line number Diff line change
@@ -1,191 +1,148 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('reactClasslistHelper', ['exports'], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.reactClasslistHelper = mod.exports;
}
})(this, function (exports) {
'use strict';
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

Object.defineProperty(exports, "__esModule", {
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

exports.isBoolean = isBoolean;
exports.isObject = isObject;
exports.isString = isString;
exports.isUndefined = isUndefined;
/**
*
* @param {*} value Any value
* @return {boolean} assertion
*/
function isBoolean(value) {
return typeof value === 'boolean' || (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null && typeof value.valueOf() === 'boolean';
}

/**
*
* @param {*} value Any value
* @return {boolean} assertion
*/
function isObject(value) {
return value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object';
}

/**
*
* @param {*} value Any value
* @return {boolean} assertion
*/
function isString(value) {
return typeof value === 'string' || value instanceof String;
}

/**
*
* @param {*} value Any value
* @return {boolean} assertion
*/
function isUndefined(value) {
return typeof value === 'undefined';
}
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isBoolean = isBoolean;
exports.isObject = isObject;
exports.isString = isString;
exports.isUndefined = isUndefined;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};

/**
*
* @param {*} value Any value
* @return {boolean} assertion
*/
function isBoolean(value) {
return typeof value === 'boolean' || (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null && typeof value.valueOf() === 'boolean';
}

/**
*
* @param {*} value Any value
* @return {boolean} assertion
*/
function isObject(value) {
return value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object';
}

/**
*
* @param {*} value Any value
* @return {boolean} assertion
*/
function isString(value) {
return typeof value === 'string' || value instanceof String;
}

/**
*
* @param {*} value Any value
* @return {boolean} assertion
*/
function isUndefined(value) {
return typeof value === 'undefined';
}
});
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('reactClasslistHelper', ['exports', './assertions'], factory);
} else if (typeof exports !== "undefined") {
factory(exports, require('./assertions'));
} else {
var mod = {
exports: {}
};
factory(mod.exports, global.assertions);
global.reactClasslistHelper = mod.exports;
}
})(this, function (exports, _assertions) {
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.tC = exports.cL = undefined;
exports.classList = classList;
exports.toggleClass = toggleClass;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
exports.tC = exports.cL = undefined;

function _toConsumableArray(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

return arr2;
} else {
return Array.from(arr);
}
}
exports.classList = classList;
exports.toggleClass = toggleClass;

/**
* Spred css class names provided as input
*
* @param {Array} args The classe's names.
* @return {string} final className
*/
function classList() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _assertions = require('./assertions');

if (args.length === 0) {
return '';
}
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

var classBuffer = [];
/**
* Spred css class names provided as input
*
* @param {Array} args The classe's names.
* @return {string} final className
*/
function classList() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

var _a = args;
if (args.length === 0) {
return '';
}

var _f = function _f(className) {
if (Array.isArray(className)) {
classBuffer = [].concat(_toConsumableArray(classBuffer), [className.reduce(function (total, curItem) {
return total + ' ' + curItem;
})]);
} else if ((0, _assertions.isString)(className)) {
classBuffer = [].concat(_toConsumableArray(classBuffer), [className]);
} else if ((0, _assertions.isObject)(className)) {
var keys = Object.keys(className);
var classBuffer = [];

var _a2 = keys;
var _a = args;

var _f2 = function _f2(key) {
if (className[key] === true) {
classBuffer = [].concat(_toConsumableArray(classBuffer), [key]);
}
};
var _f = function _f(className) {
if (Array.isArray(className)) {
classBuffer = [].concat(_toConsumableArray(classBuffer), [className.reduce(function (total, curItem) {
return total + ' ' + curItem;
})]);
} else if ((0, _assertions.isString)(className)) {
classBuffer = [].concat(_toConsumableArray(classBuffer), [className]);
} else if ((0, _assertions.isObject)(className)) {
var keys = Object.keys(className);

for (var _i2 = 0; _i2 < _a2.length; _i2++) {
_f2(_a2[_i2], _i2, _a2);
var _a2 = keys;

var _f2 = function _f2(key) {
if (className[key] === true) {
classBuffer = [].concat(_toConsumableArray(classBuffer), [key]);
}
};

undefined;
} else {
throw new Error('Expected className to be a string but instead got ' + (typeof className === 'undefined' ? 'undefined' : _typeof(className)));
for (var _i2 = 0; _i2 < _a2.length; _i2++) {
_f2(_a2[_i2], _i2, _a2);
}
};

for (var _i = 0; _i < _a.length; _i++) {
_f(_a[_i], _i, _a);
undefined;
} else {
throw new Error('Expected className to be a string but instead got ' + (typeof className === 'undefined' ? 'undefined' : _typeof(className)));
}
};

undefined;

return classBuffer.join(' ').trim();
for (var _i = 0; _i < _a.length; _i++) {
_f(_a[_i], _i, _a);
}

/**
* Toggle a class based on a condition.
*
* @param {string} className The class name
* @param {boolean} condition The condition
* @return {string} if condition is true, returns the string, if false,
* returns empty string
*/
function toggleClass(className, condition) {
if ((0, _assertions.isUndefined)(className) || !(0, _assertions.isString)(className)) {
throw new Error('Expected className to be a string but instead got ' + (typeof className === 'undefined' ? 'undefined' : _typeof(className)));
}
undefined;

return classBuffer.join(' ').trim();
}

/**
* Toggle a class based on a condition.
*
* @param {string} className The class name
* @param {boolean} condition The condition
* @return {string} if condition is true, returns the string, if false,
* returns empty string
*/
function toggleClass(className, condition) {
if ((0, _assertions.isUndefined)(className) || !(0, _assertions.isString)(className)) {
throw new Error('Expected className to be a string but instead got ' + (typeof className === 'undefined' ? 'undefined' : _typeof(className)));
}

if ((0, _assertions.isUndefined)(condition) || !(0, _assertions.isBoolean)(condition)) {
throw new Error('Expected condition to be a boolean value but instead got ' + (typeof condition === 'undefined' ? 'undefined' : _typeof(condition)));
}
if ((0, _assertions.isUndefined)(condition) || !(0, _assertions.isBoolean)(condition)) {
throw new Error('Expected condition to be a boolean value but instead got ' + (typeof condition === 'undefined' ? 'undefined' : _typeof(condition)));
}

var ClassMap = {};
ClassMap[className] = condition;
var ClassMap = {};
ClassMap[className] = condition;

return classList(ClassMap);
}
return classList(ClassMap);
}

var cL = exports.cL = classList;
var tC = exports.tC = toggleClass;
var cL = exports.cL = classList;
var tC = exports.tC = toggleClass;

var defaultFunc = classList;
var defaultFunc = classList;

exports.default = defaultFunc;
});
exports.default = defaultFunc;

0 comments on commit e3be4d5

Please sign in to comment.