var buildMoldsSelector = require('./build-molds-selector');

module.exports = function fillMold(raw, fillers, alias) {

	var filled;
	var moldsSelector = buildMoldsSelector(alias);
	var moldSelected;

	while(moldSelected = moldsSelector.exec(raw)) {
		filled = raw.replace(moldSelected[0], fillers[moldSelected[1]]);
	}
	if(!filled) return raw;
	return filled;

};

var buildMoldsSelector = require('./build-molds-selector');

module.exports = function fillMold(raw, fillers, alias) {

	var moldsSelector = buildMoldsSelector(alias);
	var moldSelected;

	while(moldSelected = moldsSelector.exec(raw)) {
		raw = raw.replace(
			new RegExp(moldSelected[0], 'g'),
			fillers[moldSelected[1]]
		);
	}
	return raw;

};

Add support of multiple molds per raw
Add support of multiple molds per raw
