Edit File by line
/home/barbar84/public_h.../wp-inclu.../js/dist
File: wordcount.js
this["wp"] = this["wp"] || {}; this["wp"]["wordcount"] =
[0] Fix | Delete
/******/ (function(modules) { // webpackBootstrap
[1] Fix | Delete
/******/ // The module cache
[2] Fix | Delete
/******/ var installedModules = {};
[3] Fix | Delete
/******/
[4] Fix | Delete
/******/ // The require function
[5] Fix | Delete
/******/ function __webpack_require__(moduleId) {
[6] Fix | Delete
/******/
[7] Fix | Delete
/******/ // Check if module is in cache
[8] Fix | Delete
/******/ if(installedModules[moduleId]) {
[9] Fix | Delete
/******/ return installedModules[moduleId].exports;
[10] Fix | Delete
/******/ }
[11] Fix | Delete
/******/ // Create a new module (and put it into the cache)
[12] Fix | Delete
/******/ var module = installedModules[moduleId] = {
[13] Fix | Delete
/******/ i: moduleId,
[14] Fix | Delete
/******/ l: false,
[15] Fix | Delete
/******/ exports: {}
[16] Fix | Delete
/******/ };
[17] Fix | Delete
/******/
[18] Fix | Delete
/******/ // Execute the module function
[19] Fix | Delete
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
[20] Fix | Delete
/******/
[21] Fix | Delete
/******/ // Flag the module as loaded
[22] Fix | Delete
/******/ module.l = true;
[23] Fix | Delete
/******/
[24] Fix | Delete
/******/ // Return the exports of the module
[25] Fix | Delete
/******/ return module.exports;
[26] Fix | Delete
/******/ }
[27] Fix | Delete
/******/
[28] Fix | Delete
/******/
[29] Fix | Delete
/******/ // expose the modules object (__webpack_modules__)
[30] Fix | Delete
/******/ __webpack_require__.m = modules;
[31] Fix | Delete
/******/
[32] Fix | Delete
/******/ // expose the module cache
[33] Fix | Delete
/******/ __webpack_require__.c = installedModules;
[34] Fix | Delete
/******/
[35] Fix | Delete
/******/ // define getter function for harmony exports
[36] Fix | Delete
/******/ __webpack_require__.d = function(exports, name, getter) {
[37] Fix | Delete
/******/ if(!__webpack_require__.o(exports, name)) {
[38] Fix | Delete
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
[39] Fix | Delete
/******/ }
[40] Fix | Delete
/******/ };
[41] Fix | Delete
/******/
[42] Fix | Delete
/******/ // define __esModule on exports
[43] Fix | Delete
/******/ __webpack_require__.r = function(exports) {
[44] Fix | Delete
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
[45] Fix | Delete
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
[46] Fix | Delete
/******/ }
[47] Fix | Delete
/******/ Object.defineProperty(exports, '__esModule', { value: true });
[48] Fix | Delete
/******/ };
[49] Fix | Delete
/******/
[50] Fix | Delete
/******/ // create a fake namespace object
[51] Fix | Delete
/******/ // mode & 1: value is a module id, require it
[52] Fix | Delete
/******/ // mode & 2: merge all properties of value into the ns
[53] Fix | Delete
/******/ // mode & 4: return value when already ns object
[54] Fix | Delete
/******/ // mode & 8|1: behave like require
[55] Fix | Delete
/******/ __webpack_require__.t = function(value, mode) {
[56] Fix | Delete
/******/ if(mode & 1) value = __webpack_require__(value);
[57] Fix | Delete
/******/ if(mode & 8) return value;
[58] Fix | Delete
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
[59] Fix | Delete
/******/ var ns = Object.create(null);
[60] Fix | Delete
/******/ __webpack_require__.r(ns);
[61] Fix | Delete
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
[62] Fix | Delete
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
[63] Fix | Delete
/******/ return ns;
[64] Fix | Delete
/******/ };
[65] Fix | Delete
/******/
[66] Fix | Delete
/******/ // getDefaultExport function for compatibility with non-harmony modules
[67] Fix | Delete
/******/ __webpack_require__.n = function(module) {
[68] Fix | Delete
/******/ var getter = module && module.__esModule ?
[69] Fix | Delete
/******/ function getDefault() { return module['default']; } :
[70] Fix | Delete
/******/ function getModuleExports() { return module; };
[71] Fix | Delete
/******/ __webpack_require__.d(getter, 'a', getter);
[72] Fix | Delete
/******/ return getter;
[73] Fix | Delete
/******/ };
[74] Fix | Delete
/******/
[75] Fix | Delete
/******/ // Object.prototype.hasOwnProperty.call
[76] Fix | Delete
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
[77] Fix | Delete
/******/
[78] Fix | Delete
/******/ // __webpack_public_path__
[79] Fix | Delete
/******/ __webpack_require__.p = "";
[80] Fix | Delete
/******/
[81] Fix | Delete
/******/
[82] Fix | Delete
/******/ // Load entry module and return exports
[83] Fix | Delete
/******/ return __webpack_require__(__webpack_require__.s = "pC98");
[84] Fix | Delete
/******/ })
[85] Fix | Delete
/************************************************************************/
[86] Fix | Delete
/******/ ({
[87] Fix | Delete
[88] Fix | Delete
/***/ "YLtl":
[89] Fix | Delete
/***/ (function(module, exports) {
[90] Fix | Delete
[91] Fix | Delete
(function() { module.exports = window["lodash"]; }());
[92] Fix | Delete
[93] Fix | Delete
/***/ }),
[94] Fix | Delete
[95] Fix | Delete
/***/ "pC98":
[96] Fix | Delete
/***/ (function(module, __webpack_exports__, __webpack_require__) {
[97] Fix | Delete
[98] Fix | Delete
"use strict";
[99] Fix | Delete
// ESM COMPAT FLAG
[100] Fix | Delete
__webpack_require__.r(__webpack_exports__);
[101] Fix | Delete
[102] Fix | Delete
// EXPORTS
[103] Fix | Delete
__webpack_require__.d(__webpack_exports__, "count", function() { return /* binding */ count; });
[104] Fix | Delete
[105] Fix | Delete
// EXTERNAL MODULE: external "lodash"
[106] Fix | Delete
var external_lodash_ = __webpack_require__("YLtl");
[107] Fix | Delete
[108] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/defaultSettings.js
[109] Fix | Delete
/** @typedef {import('./index').WPWordCountStrategy} WPWordCountStrategy */
[110] Fix | Delete
[111] Fix | Delete
/** @typedef {Partial<{type: WPWordCountStrategy, shortcodes: string[]}>} WPWordCountL10n */
[112] Fix | Delete
[113] Fix | Delete
/**
[114] Fix | Delete
* @typedef WPWordCountSettingsFields
[115] Fix | Delete
* @property {RegExp} HTMLRegExp Regular expression that matches HTML tags
[116] Fix | Delete
* @property {RegExp} HTMLcommentRegExp Regular expression that matches HTML comments
[117] Fix | Delete
* @property {RegExp} spaceRegExp Regular expression that matches spaces in HTML
[118] Fix | Delete
* @property {RegExp} HTMLEntityRegExp Regular expression that matches HTML entities
[119] Fix | Delete
* @property {RegExp} connectorRegExp Regular expression that matches word connectors, like em-dash
[120] Fix | Delete
* @property {RegExp} removeRegExp Regular expression that matches various characters to be removed when counting
[121] Fix | Delete
* @property {RegExp} astralRegExp Regular expression that matches astral UTF-16 code points
[122] Fix | Delete
* @property {RegExp} wordsRegExp Regular expression that matches words
[123] Fix | Delete
* @property {RegExp} characters_excluding_spacesRegExp Regular expression that matches characters excluding spaces
[124] Fix | Delete
* @property {RegExp} characters_including_spacesRegExp Regular expression that matches characters including spaces
[125] Fix | Delete
* @property {RegExp} shortcodesRegExp Regular expression that matches WordPress shortcodes
[126] Fix | Delete
* @property {string[]} shortcodes List of all shortcodes
[127] Fix | Delete
* @property {WPWordCountStrategy} type Describes what and how are we counting
[128] Fix | Delete
* @property {WPWordCountL10n} l10n Object with human translations
[129] Fix | Delete
*/
[130] Fix | Delete
[131] Fix | Delete
/**
[132] Fix | Delete
* Lower-level settings for word counting that can be overridden.
[133] Fix | Delete
*
[134] Fix | Delete
* @typedef {Partial<WPWordCountSettingsFields>} WPWordCountUserSettings
[135] Fix | Delete
*/
[136] Fix | Delete
// Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly: https://github.com/jsdoc/jsdoc/issues/1285
[137] Fix | Delete
[138] Fix | Delete
/* eslint-disable jsdoc/valid-types */
[139] Fix | Delete
[140] Fix | Delete
/**
[141] Fix | Delete
* Word counting settings that include non-optional values we set if missing
[142] Fix | Delete
*
[143] Fix | Delete
* @typedef {WPWordCountUserSettings & typeof defaultSettings} WPWordCountDefaultSettings
[144] Fix | Delete
*/
[145] Fix | Delete
[146] Fix | Delete
/* eslint-enable jsdoc/valid-types */
[147] Fix | Delete
var defaultSettings = {
[148] Fix | Delete
HTMLRegExp: /<\/?[a-z][^>]*?>/gi,
[149] Fix | Delete
HTMLcommentRegExp: /<!--[\s\S]*?-->/g,
[150] Fix | Delete
spaceRegExp: /&nbsp;|&#160;/gi,
[151] Fix | Delete
HTMLEntityRegExp: /&\S+?;/g,
[152] Fix | Delete
// \u2014 = em-dash
[153] Fix | Delete
connectorRegExp: /--|\u2014/g,
[154] Fix | Delete
// Characters to be removed from input text.
[155] Fix | Delete
removeRegExp: new RegExp(['[', // Basic Latin (extract)
[156] Fix | Delete
"!-@[-`{-~", // Latin-1 Supplement (extract)
[157] Fix | Delete
"\x80-\xBF\xD7\xF7",
[158] Fix | Delete
/*
[159] Fix | Delete
* The following range consists of:
[160] Fix | Delete
* General Punctuation
[161] Fix | Delete
* Superscripts and Subscripts
[162] Fix | Delete
* Currency Symbols
[163] Fix | Delete
* Combining Diacritical Marks for Symbols
[164] Fix | Delete
* Letterlike Symbols
[165] Fix | Delete
* Number Forms
[166] Fix | Delete
* Arrows
[167] Fix | Delete
* Mathematical Operators
[168] Fix | Delete
* Miscellaneous Technical
[169] Fix | Delete
* Control Pictures
[170] Fix | Delete
* Optical Character Recognition
[171] Fix | Delete
* Enclosed Alphanumerics
[172] Fix | Delete
* Box Drawing
[173] Fix | Delete
* Block Elements
[174] Fix | Delete
* Geometric Shapes
[175] Fix | Delete
* Miscellaneous Symbols
[176] Fix | Delete
* Dingbats
[177] Fix | Delete
* Miscellaneous Mathematical Symbols-A
[178] Fix | Delete
* Supplemental Arrows-A
[179] Fix | Delete
* Braille Patterns
[180] Fix | Delete
* Supplemental Arrows-B
[181] Fix | Delete
* Miscellaneous Mathematical Symbols-B
[182] Fix | Delete
* Supplemental Mathematical Operators
[183] Fix | Delete
* Miscellaneous Symbols and Arrows
[184] Fix | Delete
*/
[185] Fix | Delete
"\u2000-\u2BFF", // Supplemental Punctuation
[186] Fix | Delete
"\u2E00-\u2E7F", ']'].join(''), 'g'),
[187] Fix | Delete
// Remove UTF-16 surrogate points, see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF
[188] Fix | Delete
astralRegExp: /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
[189] Fix | Delete
wordsRegExp: /\S\s+/g,
[190] Fix | Delete
characters_excluding_spacesRegExp: /\S/g,
[191] Fix | Delete
[192] Fix | Delete
/*
[193] Fix | Delete
* Match anything that is not a formatting character, excluding:
[194] Fix | Delete
* \f = form feed
[195] Fix | Delete
* \n = new line
[196] Fix | Delete
* \r = carriage return
[197] Fix | Delete
* \t = tab
[198] Fix | Delete
* \v = vertical tab
[199] Fix | Delete
* \u00AD = soft hyphen
[200] Fix | Delete
* \u2028 = line separator
[201] Fix | Delete
* \u2029 = paragraph separator
[202] Fix | Delete
*/
[203] Fix | Delete
characters_including_spacesRegExp: /[^\f\n\r\t\v\u00AD\u2028\u2029]/g,
[204] Fix | Delete
l10n: {
[205] Fix | Delete
type: 'words'
[206] Fix | Delete
}
[207] Fix | Delete
};
[208] Fix | Delete
[209] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/stripTags.js
[210] Fix | Delete
/**
[211] Fix | Delete
* Replaces items matched in the regex with new line
[212] Fix | Delete
*
[213] Fix | Delete
* @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions
[214] Fix | Delete
* @param {string} text The string being counted.
[215] Fix | Delete
*
[216] Fix | Delete
* @return {string} The manipulated text.
[217] Fix | Delete
*/
[218] Fix | Delete
function stripTags(settings, text) {
[219] Fix | Delete
return text.replace(settings.HTMLRegExp, '\n');
[220] Fix | Delete
}
[221] Fix | Delete
[222] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/transposeAstralsToCountableChar.js
[223] Fix | Delete
/**
[224] Fix | Delete
* Replaces items matched in the regex with character.
[225] Fix | Delete
*
[226] Fix | Delete
* @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions
[227] Fix | Delete
* @param {string} text The string being counted.
[228] Fix | Delete
*
[229] Fix | Delete
* @return {string} The manipulated text.
[230] Fix | Delete
*/
[231] Fix | Delete
function transposeAstralsToCountableChar(settings, text) {
[232] Fix | Delete
return text.replace(settings.astralRegExp, 'a');
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/stripHTMLEntities.js
[236] Fix | Delete
/**
[237] Fix | Delete
* Removes items matched in the regex.
[238] Fix | Delete
*
[239] Fix | Delete
* @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions
[240] Fix | Delete
* @param {string} text The string being counted.
[241] Fix | Delete
*
[242] Fix | Delete
* @return {string} The manipulated text.
[243] Fix | Delete
*/
[244] Fix | Delete
function stripHTMLEntities(settings, text) {
[245] Fix | Delete
return text.replace(settings.HTMLEntityRegExp, '');
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/stripConnectors.js
[249] Fix | Delete
/**
[250] Fix | Delete
* Replaces items matched in the regex with spaces.
[251] Fix | Delete
*
[252] Fix | Delete
* @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions
[253] Fix | Delete
* @param {string} text The string being counted.
[254] Fix | Delete
*
[255] Fix | Delete
* @return {string} The manipulated text.
[256] Fix | Delete
*/
[257] Fix | Delete
function stripConnectors(settings, text) {
[258] Fix | Delete
return text.replace(settings.connectorRegExp, ' ');
[259] Fix | Delete
}
[260] Fix | Delete
[261] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/stripRemovables.js
[262] Fix | Delete
/**
[263] Fix | Delete
* Removes items matched in the regex.
[264] Fix | Delete
*
[265] Fix | Delete
* @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions
[266] Fix | Delete
* @param {string} text The string being counted.
[267] Fix | Delete
*
[268] Fix | Delete
* @return {string} The manipulated text.
[269] Fix | Delete
*/
[270] Fix | Delete
function stripRemovables(settings, text) {
[271] Fix | Delete
return text.replace(settings.removeRegExp, '');
[272] Fix | Delete
}
[273] Fix | Delete
[274] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/stripHTMLComments.js
[275] Fix | Delete
/**
[276] Fix | Delete
* Removes items matched in the regex.
[277] Fix | Delete
*
[278] Fix | Delete
* @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions
[279] Fix | Delete
* @param {string} text The string being counted.
[280] Fix | Delete
*
[281] Fix | Delete
* @return {string} The manipulated text.
[282] Fix | Delete
*/
[283] Fix | Delete
function stripHTMLComments(settings, text) {
[284] Fix | Delete
return text.replace(settings.HTMLcommentRegExp, '');
[285] Fix | Delete
}
[286] Fix | Delete
[287] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/stripShortcodes.js
[288] Fix | Delete
/**
[289] Fix | Delete
* Replaces items matched in the regex with a new line.
[290] Fix | Delete
*
[291] Fix | Delete
* @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions
[292] Fix | Delete
* @param {string} text The string being counted.
[293] Fix | Delete
*
[294] Fix | Delete
* @return {string} The manipulated text.
[295] Fix | Delete
*/
[296] Fix | Delete
function stripShortcodes(settings, text) {
[297] Fix | Delete
if (settings.shortcodesRegExp) {
[298] Fix | Delete
return text.replace(settings.shortcodesRegExp, '\n');
[299] Fix | Delete
}
[300] Fix | Delete
[301] Fix | Delete
return text;
[302] Fix | Delete
}
[303] Fix | Delete
[304] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/stripSpaces.js
[305] Fix | Delete
/**
[306] Fix | Delete
* Replaces items matched in the regex with spaces.
[307] Fix | Delete
*
[308] Fix | Delete
* @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions
[309] Fix | Delete
* @param {string} text The string being counted.
[310] Fix | Delete
*
[311] Fix | Delete
* @return {string} The manipulated text.
[312] Fix | Delete
*/
[313] Fix | Delete
function stripSpaces(settings, text) {
[314] Fix | Delete
return text.replace(settings.spaceRegExp, ' ');
[315] Fix | Delete
}
[316] Fix | Delete
[317] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/transposeHTMLEntitiesToCountableChars.js
[318] Fix | Delete
/**
[319] Fix | Delete
* Replaces items matched in the regex with a single character.
[320] Fix | Delete
*
[321] Fix | Delete
* @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions
[322] Fix | Delete
* @param {string} text The string being counted.
[323] Fix | Delete
*
[324] Fix | Delete
* @return {string} The manipulated text.
[325] Fix | Delete
*/
[326] Fix | Delete
function transposeHTMLEntitiesToCountableChars(settings, text) {
[327] Fix | Delete
return text.replace(settings.HTMLEntityRegExp, 'a');
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/wordcount/build-module/index.js
[331] Fix | Delete
/**
[332] Fix | Delete
* External dependencies
[333] Fix | Delete
*/
[334] Fix | Delete
[335] Fix | Delete
/**
[336] Fix | Delete
* Internal dependencies
[337] Fix | Delete
*/
[338] Fix | Delete
[339] Fix | Delete
[340] Fix | Delete
[341] Fix | Delete
[342] Fix | Delete
[343] Fix | Delete
[344] Fix | Delete
[345] Fix | Delete
[346] Fix | Delete
[347] Fix | Delete
[348] Fix | Delete
[349] Fix | Delete
/**
[350] Fix | Delete
* @typedef {import('./defaultSettings').WPWordCountDefaultSettings} WPWordCountSettings
[351] Fix | Delete
* @typedef {import('./defaultSettings').WPWordCountUserSettings} WPWordCountUserSettings
[352] Fix | Delete
*/
[353] Fix | Delete
[354] Fix | Delete
/**
[355] Fix | Delete
* Possible ways of counting.
[356] Fix | Delete
*
[357] Fix | Delete
* @typedef {'words'|'characters_excluding_spaces'|'characters_including_spaces'} WPWordCountStrategy
[358] Fix | Delete
*/
[359] Fix | Delete
[360] Fix | Delete
/**
[361] Fix | Delete
* Private function to manage the settings.
[362] Fix | Delete
*
[363] Fix | Delete
* @param {WPWordCountStrategy} type The type of count to be done.
[364] Fix | Delete
* @param {WPWordCountUserSettings} userSettings Custom settings for the count.
[365] Fix | Delete
*
[366] Fix | Delete
* @return {WPWordCountSettings} The combined settings object to be used.
[367] Fix | Delete
*/
[368] Fix | Delete
[369] Fix | Delete
function loadSettings(type, userSettings) {
[370] Fix | Delete
var _settings$l10n$shortc, _settings$l10n;
[371] Fix | Delete
[372] Fix | Delete
var settings = Object(external_lodash_["extend"])({}, defaultSettings, userSettings);
[373] Fix | Delete
settings.shortcodes = (_settings$l10n$shortc = (_settings$l10n = settings.l10n) === null || _settings$l10n === void 0 ? void 0 : _settings$l10n.shortcodes) !== null && _settings$l10n$shortc !== void 0 ? _settings$l10n$shortc : [];
[374] Fix | Delete
[375] Fix | Delete
if (settings.shortcodes && settings.shortcodes.length) {
[376] Fix | Delete
settings.shortcodesRegExp = new RegExp('\\[\\/?(?:' + settings.shortcodes.join('|') + ')[^\\]]*?\\]', 'g');
[377] Fix | Delete
}
[378] Fix | Delete
[379] Fix | Delete
settings.type = type;
[380] Fix | Delete
[381] Fix | Delete
if (settings.type !== 'characters_excluding_spaces' && settings.type !== 'characters_including_spaces') {
[382] Fix | Delete
settings.type = 'words';
[383] Fix | Delete
}
[384] Fix | Delete
[385] Fix | Delete
return settings;
[386] Fix | Delete
}
[387] Fix | Delete
/**
[388] Fix | Delete
* Count the words in text
[389] Fix | Delete
*
[390] Fix | Delete
* @param {string} text The text being processed
[391] Fix | Delete
* @param {RegExp} regex The regular expression pattern being matched
[392] Fix | Delete
* @param {WPWordCountSettings} settings Settings object containing regular expressions for each strip function
[393] Fix | Delete
*
[394] Fix | Delete
* @return {number} Count of words.
[395] Fix | Delete
*/
[396] Fix | Delete
[397] Fix | Delete
[398] Fix | Delete
function countWords(text, regex, settings) {
[399] Fix | Delete
var _text$match$length, _text$match;
[400] Fix | Delete
[401] Fix | Delete
text = Object(external_lodash_["flow"])(stripTags.bind(null, settings), stripHTMLComments.bind(null, settings), stripShortcodes.bind(null, settings), stripSpaces.bind(null, settings), stripHTMLEntities.bind(null, settings), stripConnectors.bind(null, settings), stripRemovables.bind(null, settings))(text);
[402] Fix | Delete
text = text + '\n';
[403] Fix | Delete
return (_text$match$length = (_text$match = text.match(regex)) === null || _text$match === void 0 ? void 0 : _text$match.length) !== null && _text$match$length !== void 0 ? _text$match$length : 0;
[404] Fix | Delete
}
[405] Fix | Delete
/**
[406] Fix | Delete
* Count the characters in text
[407] Fix | Delete
*
[408] Fix | Delete
* @param {string} text The text being processed
[409] Fix | Delete
* @param {RegExp} regex The regular expression pattern being matched
[410] Fix | Delete
* @param {WPWordCountSettings} settings Settings object containing regular expressions for each strip function
[411] Fix | Delete
*
[412] Fix | Delete
* @return {number} Count of characters.
[413] Fix | Delete
*/
[414] Fix | Delete
[415] Fix | Delete
[416] Fix | Delete
function countCharacters(text, regex, settings) {
[417] Fix | Delete
var _text$match$length2, _text$match2;
[418] Fix | Delete
[419] Fix | Delete
text = Object(external_lodash_["flow"])(stripTags.bind(null, settings), stripHTMLComments.bind(null, settings), stripShortcodes.bind(null, settings), transposeAstralsToCountableChar.bind(null, settings), stripSpaces.bind(null, settings), transposeHTMLEntitiesToCountableChars.bind(null, settings))(text);
[420] Fix | Delete
text = text + '\n';
[421] Fix | Delete
return (_text$match$length2 = (_text$match2 = text.match(regex)) === null || _text$match2 === void 0 ? void 0 : _text$match2.length) !== null && _text$match$length2 !== void 0 ? _text$match$length2 : 0;
[422] Fix | Delete
}
[423] Fix | Delete
/**
[424] Fix | Delete
* Count some words.
[425] Fix | Delete
*
[426] Fix | Delete
* @param {string} text The text being processed
[427] Fix | Delete
* @param {WPWordCountStrategy} type The type of count. Accepts 'words', 'characters_excluding_spaces', or 'characters_including_spaces'.
[428] Fix | Delete
* @param {WPWordCountUserSettings} userSettings Custom settings object.
[429] Fix | Delete
*
[430] Fix | Delete
* @example
[431] Fix | Delete
* ```js
[432] Fix | Delete
* import { count } from '@wordpress/wordcount';
[433] Fix | Delete
* const numberOfWords = count( 'Words to count', 'words', {} )
[434] Fix | Delete
* ```
[435] Fix | Delete
*
[436] Fix | Delete
* @return {number} The word or character count.
[437] Fix | Delete
*/
[438] Fix | Delete
[439] Fix | Delete
[440] Fix | Delete
function count(text, type, userSettings) {
[441] Fix | Delete
var settings = loadSettings(type, userSettings);
[442] Fix | Delete
var matchRegExp;
[443] Fix | Delete
[444] Fix | Delete
switch (settings.type) {
[445] Fix | Delete
case 'words':
[446] Fix | Delete
matchRegExp = settings.wordsRegExp;
[447] Fix | Delete
return countWords(text, matchRegExp, settings);
[448] Fix | Delete
[449] Fix | Delete
case 'characters_including_spaces':
[450] Fix | Delete
matchRegExp = settings.characters_including_spacesRegExp;
[451] Fix | Delete
return countCharacters(text, matchRegExp, settings);
[452] Fix | Delete
[453] Fix | Delete
case 'characters_excluding_spaces':
[454] Fix | Delete
matchRegExp = settings.characters_excluding_spacesRegExp;
[455] Fix | Delete
return countCharacters(text, matchRegExp, settings);
[456] Fix | Delete
[457] Fix | Delete
default:
[458] Fix | Delete
return 0;
[459] Fix | Delete
}
[460] Fix | Delete
}
[461] Fix | Delete
[462] Fix | Delete
[463] Fix | Delete
/***/ })
[464] Fix | Delete
[465] Fix | Delete
/******/ });
[466] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function