Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wordpress/wordcount

Package Overview
Dependencies
Maintainers
25
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/wordcount - npm Package Compare versions

Comparing version 3.11.0 to 3.12.0

11

build-module/index.js
/**
* External dependencies
*/
import { extend, flow } from 'lodash';
/**
* Internal dependencies
*/
import { defaultSettings } from './defaultSettings';

@@ -42,3 +37,3 @@ import stripTags from './stripTags';

const settings = extend({}, defaultSettings, userSettings);
const settings = Object.assign({}, defaultSettings, userSettings);
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 : [];

@@ -72,3 +67,3 @@

text = 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);
text = [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)].reduce((result, fn) => fn(result), text);
text = text + '\n';

@@ -91,3 +86,3 @@ 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;

text = 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);
text = [stripTags.bind(null, settings), stripHTMLComments.bind(null, settings), stripShortcodes.bind(null, settings), transposeAstralsToCountableChar.bind(null, settings), stripSpaces.bind(null, settings), transposeHTMLEntitiesToCountableChars.bind(null, settings)].reduce((result, fn) => fn(result), text);
text = text + '\n';

@@ -94,0 +89,0 @@ 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;

@@ -10,4 +10,2 @@ "use strict";

var _lodash = require("lodash");
var _defaultSettings = require("./defaultSettings");

@@ -34,6 +32,2 @@

/**
* External dependencies
*/
/**
* Internal dependencies

@@ -64,3 +58,3 @@ */

const settings = (0, _lodash.extend)({}, _defaultSettings.defaultSettings, userSettings);
const settings = Object.assign({}, _defaultSettings.defaultSettings, userSettings);
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 : [];

@@ -94,3 +88,3 @@

text = (0, _lodash.flow)(_stripTags.default.bind(null, settings), _stripHTMLComments.default.bind(null, settings), _stripShortcodes.default.bind(null, settings), _stripSpaces.default.bind(null, settings), _stripHTMLEntities.default.bind(null, settings), _stripConnectors.default.bind(null, settings), _stripRemovables.default.bind(null, settings))(text);
text = [_stripTags.default.bind(null, settings), _stripHTMLComments.default.bind(null, settings), _stripShortcodes.default.bind(null, settings), _stripSpaces.default.bind(null, settings), _stripHTMLEntities.default.bind(null, settings), _stripConnectors.default.bind(null, settings), _stripRemovables.default.bind(null, settings)].reduce((result, fn) => fn(result), text);
text = text + '\n';

@@ -113,3 +107,3 @@ 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;

text = (0, _lodash.flow)(_stripTags.default.bind(null, settings), _stripHTMLComments.default.bind(null, settings), _stripShortcodes.default.bind(null, settings), _transposeAstralsToCountableChar.default.bind(null, settings), _stripSpaces.default.bind(null, settings), _transposeHTMLEntitiesToCountableChars.default.bind(null, settings))(text);
text = [_stripTags.default.bind(null, settings), _stripHTMLComments.default.bind(null, settings), _stripShortcodes.default.bind(null, settings), _transposeAstralsToCountableChar.default.bind(null, settings), _stripSpaces.default.bind(null, settings), _transposeHTMLEntitiesToCountableChars.default.bind(null, settings)].reduce((result, fn) => fn(result), text);
text = text + '\n';

@@ -116,0 +110,0 @@ 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;

@@ -5,2 +5,4 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## 3.12.0 (2022-06-29)
## 3.11.0 (2022-06-15)

@@ -7,0 +9,0 @@

{
"name": "@wordpress/wordcount",
"version": "3.11.0",
"version": "3.12.0",
"description": "WordPress word count utility.",

@@ -29,4 +29,3 @@ "author": "The WordPress Contributors",

"dependencies": {
"@babel/runtime": "^7.16.0",
"lodash": "^4.17.21"
"@babel/runtime": "^7.16.0"
},

@@ -36,3 +35,3 @@ "publishConfig": {

},
"gitHead": "48d5f37dfb52d2e77c8eeb662f9874cf141b8c6b"
"gitHead": "a80eeb62ec7cb1418b9915c277e084a29d6665e3"
}
/**
* External dependencies
*/
import { extend, flow } from 'lodash';
/**
* Internal dependencies

@@ -40,3 +35,3 @@ */

function loadSettings( type, userSettings ) {
const settings = extend( {}, defaultSettings, userSettings );
const settings = Object.assign( {}, defaultSettings, userSettings );

@@ -74,3 +69,3 @@ settings.shortcodes = settings.l10n?.shortcodes ?? [];

function countWords( text, regex, settings ) {
text = flow(
text = [
stripTags.bind( null, settings ),

@@ -82,4 +77,4 @@ stripHTMLComments.bind( null, settings ),

stripConnectors.bind( null, settings ),
stripRemovables.bind( null, settings )
)( text );
stripRemovables.bind( null, settings ),
].reduce( ( result, fn ) => fn( result ), text );
text = text + '\n';

@@ -99,3 +94,3 @@ return text.match( regex )?.length ?? 0;

function countCharacters( text, regex, settings ) {
text = flow(
text = [
stripTags.bind( null, settings ),

@@ -106,4 +101,4 @@ stripHTMLComments.bind( null, settings ),

stripSpaces.bind( null, settings ),
transposeHTMLEntitiesToCountableChars.bind( null, settings )
)( text );
transposeHTMLEntitiesToCountableChars.bind( null, settings ),
].reduce( ( result, fn ) => fn( result ), text );
text = text + '\n';

@@ -110,0 +105,0 @@ return text.match( regex )?.length ?? 0;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc