<commit_before>const decl = require('postcss-js-mixins/lib/declaration');
const rule = require('postcss-js-mixins/lib/rule');
const { isObject, isEmpty, isPercentage, isColor, prefix, isNumber, hexToRgba, calcOpacity, isString, unit } = require('postcss-js-mixins/lib/helpers');


module.exports = (vars = {}) => {
	return {
		/**
		 * Absolute positioning
		 *
		 * @param {string|number|Object} [args[]] - top or object of positions
		 *	 @param {string|number} [args[].top]
		 *	 @param {string|number} [args[].right]
		 *	 @param {string|number} [args[].bottom]
		 *	 @param {string|number} [args[].left]
		 * @param {string|number} [args[]] - right
		 * @param {string|number} [args[]] - bottom
		 * @param {string|number} [args[]] - left
		 * @return {Array}
		 */
		absolute(...args) {
			let props = [
				decl('position', 'absolute')
			];

			if (isObject(args[0])) {
				props = props.concat(decl.createManyFromObj(args[0]));
			} else if (! isEmpty(args)) {
				props = props.concat(decl.createMany([
					'top',
					'right',
					'left',
					'bottom'
				], args));
			}

			return props;
		},

		/**
		 * Background
		 *
		 * @param  {Array} args
		 *	 @param {string} [args[]] - color
		 *	 @param {string} [args[]] - opacity or URL
		 *	 @param {number|string} [args[]] - repeat or attachment
		 *	 @param {number|string} [args[]] - attachment or position x
		 *	 @param {number|string} [args[]] - position x or position y
		 *	 @param {number|string} [args[]] - position y
		 * @return {Array}
		 */
		background(...args) {
			let props = [
					decl('background', '')
				],
				color = args[0];

			// TODO: Allow for object params? Shorthand needs to be in specific order.
			if (color) {
				if (args[1] && isNumber(args[1])) {
					args[0] = hexToRgba(color, args[1]);
					args.splice(1, 1);
				}

				args.forEach(function(arg, i) {
					if (i) {
						arg = ' ' + arg;
					}

					props[0].value += arg;
				});
			}

			return props;
		},

		/**
		 * Display block
		 *
		 * @param {Array} args
		 * @param {string|number|Object} [args[]] - width or object of properties
		 *	 @param {string|number} [args[].width]
		 *	 @param {string|number} [args[].height]
		 * @param {string|number} [args[]] - height
		 * @returns {Array}
		 */
		block(...args) {
			let props = [
				this.display('block')
			];

			if (isObject(args[0])) {
				props = props.concat(decl.createManyFromObj(args[0]));
			} else if (! isEmpty(args)) {
				props.push(decl('width', args[0]));

				if (args[1]) {
					props.push(decl('height', args[1]));
				}
			}

			return props;
		},

		/**
		 * Font weight bold
		 *
		 * @returns {Object}
		 */
		bold() {
			return decl('font-weight', vars.font.weight.bold);
		},

		/**
		 * Border
		 *
		 * @param args
		 * @returns {*}
		 */
		border(...args) {
			let keywords = [
					'top',
					'right',
					'bottom',
					'left',
					'vertical',
					'horizontal'
				],
				defaultValues = [
					vars.border.width,
					vars.border.style,
					vars.border.color
				],
				borders = [],
				keyword = null,
				values = [];

			if (args[0] === 'false' || args[0] === 0 || args[0] === 'none') {
				return decl('border', 'none');
			}

			// Default border
			if (isEmpty(args)) {
				return decl('border', defaultValues.join(' '));
			}

			if (keywords.includes(args[0])) {
				keyword = args[0];
				args.splice(0, 1);
			}

			// Allow user to add only color without including width and style
			if (isColor(args[0])) {
				args[2] = args.splice(0, 1);
			}

			values.push(unit(args[0] || defaultValues[0], 'border-width'));
			values.push(unit(args[1] || defaultValues[1], 'border-style'));
			values.push(unit(args[2] || defaultValues[2], 'border-color'));

			if (keyword == 'vertical') {
				borders = [
					'border-top',
					'border-bottom'
				];
			} else if (keyword == 'horizontal') {
				borders = [
					'border-left',
					'border-right'
				];
			} else if (keyword) {<commit_msg>Change order of border mixin parameters<commit_after>const decl = require('postcss-js-mixins/lib/declaration');
const rule = require('postcss-js-mixins/lib/rule');
const { isObject, isEmpty, isPercentage, isColor, prefix, isNumber, hexToRgba, calcOpacity, isString, unit } = require('postcss-js-mixins/lib/helpers');


module.exports = (vars = {}) => {
	return {
		/**
		 * Absolute positioning
		 *
		 * @param {string|number|Object} [args[]] - top or object of positions
		 *	 @param {string|number} [args[].top]
		 *	 @param {string|number} [args[].right]
		 *	 @param {string|number} [args[].bottom]
		 *	 @param {string|number} [args[].left]
		 * @param {string|number} [args[]] - right
		 * @param {string|number} [args[]] - bottom
		 * @param {string|number} [args[]] - left
		 * @return {Array}
		 */
		absolute(...args) {
			let props = [
				decl('position', 'absolute')
			];

			if (isObject(args[0])) {
				props = props.concat(decl.createManyFromObj(args[0]));
			} else if (! isEmpty(args)) {
				props = props.concat(decl.createMany([
					'top',
					'right',
					'left',
					'bottom'
				], args));
			}

			return props;
		},

		/**
		 * Background
		 *
		 * @param  {Array} args
		 *	 @param {string} [args[]] - color
		 *	 @param {string} [args[]] - opacity or URL
		 *	 @param {number|string} [args[]] - repeat or attachment
		 *	 @param {number|string} [args[]] - attachment or position x
		 *	 @param {number|string} [args[]] - position x or position y
		 *	 @param {number|string} [args[]] - position y
		 * @return {Array}
		 */
		background(...args) {
			let props = [
					decl('background', '')
				],
				color = args[0];

			// TODO: Allow for object params? Shorthand needs to be in specific order.
			if (color) {
				if (args[1] && isNumber(args[1])) {
					args[0] = hexToRgba(color, args[1]);
					args.splice(1, 1);
				}

				args.forEach(function(arg, i) {
					if (i) {
						arg = ' ' + arg;
					}

					props[0].value += arg;
				});
			}

			return props;
		},

		/**
		 * Display block
		 *
		 * @param {Array} args
		 * @param {string|number|Object} [args[]] - width or object of properties
		 *	 @param {string|number} [args[].width]
		 *	 @param {string|number} [args[].height]
		 * @param {string|number} [args[]] - height
		 * @returns {Array}
		 */
		block(...args) {
			let props = [
				this.display('block')
			];

			if (isObject(args[0])) {
				props = props.concat(decl.createManyFromObj(args[0]));
			} else if (! isEmpty(args)) {
				props.push(decl('width', args[0]));

				if (args[1]) {
					props.push(decl('height', args[1]));
				}
			}

			return props;
		},

		/**
		 * Font weight bold
		 *
		 * @returns {Object}
		 */
		bold() {
			return decl('font-weight', vars.font.weight.bold);
		},

		/**
		 * Border
		 *
		 * @param args
		 * @returns {*}
		 */
		border(...args) {
			let keywords = [
					'top',
					'right',
					'bottom',
					'left',
					'vertical',
					'horizontal'
				],
				defaultValues = [
					vars.border.width,
					vars.border.style,
					vars.border.color
				],
				borders = [],
				keyword = null,
				values = [];

			if (args[0] === 'false' || args[0] === 0 || args[0] === 'none') {
				return decl('border', 'none');
			}

			// Default border
			if (isEmpty(args)) {
				return decl('border', defaultValues.join(' '));
			}

			if (keywords.includes(args[0])) {
				keyword = args[0];
				args.splice(0, 1);
			}

			values.push(unit(args[1] || defaultValues[0], 'border-width'));
			values.push(unit(args[2] || defaultValues[1], 'border-style'));
			values.push(unit(args[0] || defaultValues[2], 'border-color'));

			if (keyword == 'vertical') {
				borders = [
					'border-top',
					'border-bottom'
				];
			} else if (keyword == 'horizontal') {
				borders = [
					'border-left',
					'border-right'
				];
			} else if (keyword) {
{'fraction_non_alphanumeric': 0.19392073874567142, 'fraction_numerical': 0.007951776324227267, 'mean_word_length': 2.6118573413617416, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5024517', 'n_tokens_mistral': 3411, 'n_tokens_neox': 2657, 'n_words': 581}