<commit_before>// ------------------------------------
// #POST - LOAD PLUGINS
// ------------------------------------

'use strict';
const path = require('path');

exports = module.exports = function (options) {
	var pkg = require(path.join((process.env.PWD || path.dirname(require.main.filename)), 'package.json'));

	if (typeof options === 'string') {
		options = require(path.join(process.cwd(), options));
	} else {
		options = options || pkg.posthtml || {};
	}

	function Processor(plugin) {
		function namespace(plugin) {
			let namespace = plugin
			.slice(9)
			.replace(/-(\w)/g, (match) => {
				return match.replace(/-/, '').toUpperCase();
			});
			return `${namespace}`;
		}

		return {
			plugin: require(`${plugin}`),
			namespace: namespace(plugin),
			defaults: {}
		};
	}

	function isPlugin(element) {
		return element.match(/posthtml-[\w]/);
	}

	function isInclude(element) {
		return element.match(/posthtml-[include]/);
	}

	function notInclude(element) {
		return element.match(/posthtml-[^include]/);
	}

	function isNotMe(element) {
		return element.match(/posthtml-[^load-plugins]/);
	}<commit_msg>Fixed #9, fixed syntax for old nodejs<commit_after>// ------------------------------------
// #POST - LOAD PLUGINS
// ------------------------------------

'use strict';
var path = require('path');

exports = module.exports = function (options) {
	var pkg = require(path.join((process.env.PWD || path.dirname(require.main.filename)), 'package.json'));

	if (typeof options === 'string') {
		options = require(path.join(process.cwd(), options));
	} else {
		options = options || pkg.posthtml || {};
	}

	function Processor(plugin) {
		function namespace(plugin) {
			var namespace = plugin
			.slice(9)
			.replace(/-(\w)/g, (match) => {
				return match.replace(/-/, '').toUpperCase();
			});
			return `${namespace}`;
		}

		return {
			plugin: require(`${plugin}`),
			namespace: namespace(plugin),
			defaults: {}
		};
	}

	function isPlugin(element) {
		return element.match(/posthtml-[\w]/);
	}

	function isInclude(element) {
		return element.match(/posthtml-[include]/);
	}

	function notInclude(element) {
		return element.match(/posthtml-[^include]/);
	}

	function isNotMe(element) {
		return element.match(/posthtml-[^load-plugins]/);
	}
{'fraction_non_alphanumeric': 0.2418645558487247, 'fraction_numerical': 0.0013192612137203166, 'mean_word_length': 2.8107202680067003, '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': '4748058', 'n_tokens_mistral': 780, 'n_tokens_neox': 702, 'n_words': 138}