How to use the regjsgen.generate function in regjsgen

To help you get started, we’ve selected a few regjsgen 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 alan-ai / alan-sdk-reactnative / testtools / node_modules / regexpu-core / rewrite-pattern.js View on Github external
}
	const regenerateOptions = {
		'hasUnicodeFlag': config.useUnicodeFlag,
		'bmpOnly': !config.unicode
	};
	const groups = {
		'onNamedGroup': options && options.onNamedGroup,
		'lastIndex': 0,
		'names': Object.create(null), // { [name]: index }
		'unmatchedReferences': Object.create(null) // { [name]: Array }
	};
	const tree = parse(pattern, flags, regjsparserFeatures);
	// Note: `processTerm` mutates `tree` and `groups`.
	processTerm(tree, regenerateOptions, groups);
	assertNoUnmatchedReferences(groups);
	return generate(tree);
};
github weixin / Miaow / node_modules / regexpu-core / rewrite-pattern.js View on Github external
const regjsparserFeatures = {
		'unicodePropertyEscape': options && options.unicodePropertyEscape
	};
	config.ignoreCase = flags && flags.includes('i');
	config.unicode = flags && flags.includes('u');
	const supportDotAllFlag = options && options.dotAllFlag;
	config.dotAll = supportDotAllFlag && flags && flags.includes('s');
	config.useUnicodeFlag = options && options.useUnicodeFlag;
	const regenerateOptions = {
		'hasUnicodeFlag': config.useUnicodeFlag,
		'bmpOnly': !config.unicode
	};
	const tree = parse(pattern, flags, regjsparserFeatures);
	// Note: `processTerm` mutates `tree`.
	processTerm(tree, regenerateOptions);
	return generate(tree);
};
github mathiasbynens / regexpu-core / rewrite-pattern.js View on Github external
config.unicodePropertyEscape = options && options.unicodePropertyEscape;
	const regenerateOptions = {
		'hasUnicodeFlag': config.useUnicodeFlag,
		'bmpOnly': !config.unicode
	};
	const groups = {
		'onNamedGroup': options && options.onNamedGroup,
		'lastIndex': 0,
		'names': Object.create(null), // { [name]: index }
		'unmatchedReferences': Object.create(null) // { [name]: Array }
	};
	const tree = parse(pattern, flags, regjsparserFeatures);
	// Note: `processTerm` mutates `tree` and `groups`.
	processTerm(tree, regenerateOptions, groups);
	assertNoUnmatchedReferences(groups);
	return generate(tree);
};
github ifgyong / demo / React-native / Helloword / node_modules / babel-plugin-transform-es2015-unicode-regex / node_modules / regexpu-core / rewrite-pattern.js View on Github external
module.exports = function (pattern, flags) {
    var tree = parse(pattern, flags);
    ignoreCase = flags ? flags.indexOf('i') > -1 : false;
    unicode = flags ? flags.indexOf('u') > -1 : false;
    assign(tree, processTerm(tree));
    return generate(tree);
};
github mathiasbynens / regexpu / rewrite-pattern.js View on Github external
module.exports = function(pattern, flags) {
	var tree = parse(pattern, flags);
	ignoreCase = flags ? flags.indexOf('i') > -1 : false;
	unicode = flags ? flags.indexOf('u') > -1 : false;
	assign(tree, processTerm(tree));
	return generate(tree);
};

regjsgen

Generate regular expressions from regjsparser’s AST.

MIT
Latest version published 2 years ago

Package Health Score

69 / 100
Full package analysis

Popular regjsgen functions