How to use the compose-function.apply function in compose-function

To help you get started, we’ve selected a few compose-function examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vorpaljs / bash-parser / src / modes / bash / rules / alias-substitution.js View on Github external
module.exports = (options, mode, previousPhases) => {
	if (typeof options.resolveAlias !== 'function') {
		return identity;
	}

	const preAliasLexer = compose.apply(null, previousPhases.reverse());
	const visitor = expandAlias(preAliasLexer, options.resolveAlias, values(mode.enums.reservedWords));

	return compose(
		merge,
		map(
			tokens.applyTokenizerVisitor(visitor)
		)
	);
};
github vorpaljs / bash-parser / src / modes / posix / rules / alias-substitution.js View on Github external
module.exports = (options, mode, previousPhases) => {
	if (typeof options.resolveAlias !== 'function') {
		return identity;
	}

	const preAliasLexer = compose.apply(null, previousPhases.reverse());
	const visitor = expandAlias(preAliasLexer, options.resolveAlias);

	return compose(
		merge,
		map(
			tokens.applyTokenizerVisitor(visitor)
		)
	);
};
github vorpaljs / bash-parser / src / shell-lexer.js View on Github external
setInput(source) {
		const tokenizer = mode.tokenizer(options);
		let previousPhases = [tokenizer];
		const phases = [tokenizer]
			.concat(mode.lexerPhases.map(phase => {
				const ph = phase(options, mode, previousPhases);
				previousPhases = previousPhases.concat(ph);
				return ph;
			}));

		const tokenize = compose.apply(null, phases.reverse());
		this.tokenizer = tokenize(source);
	}
});