Sha256: 3c62e533f16b4f8f1bfc7b3115cb3282d47814ee311404b0d2a326b0ecd7185c

Contents?: true

Size: 814 Bytes

Versions: 24

Compression:

Stored size: 814 Bytes

Contents

'use strict';

var Path = require('path');
var slice = Array.prototype.slice;

function join(/* globs */) {
	var args;

	args = slice.call(arguments, 0);
	return args.reduce(function (result, globs) {
		return _apply(result, function (path) {
			return _apply(globs, function (glob) {
				return _join(path, glob);
			});
		});
	}, '');
}

function _apply(values, fn) {
	if (Array.isArray(values)) {
		return values.reduce(function (result, value) {
			return result.concat(fn(value));
		}, []);
	}
	return fn(values);
}

function _join(path, glob) {
	var negative, positive;

	if (glob[0] === '!') {
		positive = glob.substr(1);
		if (path[0] === '!') {
			negative = '';
		} else {
			negative = '!';
		}
		return negative + Path.join(path, positive);
	}
	return Path.join(path, glob);
}

module.exports = join;

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/globjoin/index.js
trusty-cms-5.0.7 node_modules/globjoin/index.js
trusty-cms-5.0.6 node_modules/globjoin/index.js
trusty-cms-5.0.5 node_modules/globjoin/index.js
trusty-cms-5.0.4 node_modules/globjoin/index.js
trusty-cms-5.0.3 node_modules/globjoin/index.js
trusty-cms-5.0.2 node_modules/globjoin/index.js
trusty-cms-5.0.1 node_modules/globjoin/index.js
trusty-cms-4.3.5 node_modules/globjoin/index.js
trusty-cms-5.0.0 node_modules/globjoin/index.js
trusty-cms-4.3.4 node_modules/globjoin/index.js
trusty-cms-4.3.3 node_modules/globjoin/index.js
trusty-cms-4.3.2 node_modules/globjoin/index.js
trusty-cms-4.3.1 node_modules/globjoin/index.js
trusty-cms-4.3 node_modules/globjoin/index.js
trusty-cms-4.2.3 node_modules/globjoin/index.js
trusty-cms-4.2.2 node_modules/globjoin/index.js
trusty-cms-4.2.1 node_modules/globjoin/index.js
trusty-cms-4.2 node_modules/globjoin/index.js
trusty-cms-4.1.9 node_modules/globjoin/index.js