@wordpress/wordcount
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -81,5 +81,8 @@ import { extend, flow } from 'lodash'; | ||
export function count(text, type, userSettings) { | ||
var settings = loadSettings(type, userSettings); | ||
if ('' === text) { | ||
return 0; | ||
} | ||
if (text) { | ||
var settings = loadSettings(type, userSettings); | ||
var matchRegExp = settings[type + 'RegExp']; | ||
@@ -86,0 +89,0 @@ var results = 'words' === settings.type ? matchWords(text, matchRegExp, settings) : matchCharacters(text, matchRegExp, settings); |
@@ -100,5 +100,8 @@ "use strict"; | ||
function count(text, type, userSettings) { | ||
var settings = loadSettings(type, userSettings); | ||
if ('' === text) { | ||
return 0; | ||
} | ||
if (text) { | ||
var settings = loadSettings(type, userSettings); | ||
var matchRegExp = settings[type + 'RegExp']; | ||
@@ -105,0 +108,0 @@ var results = 'words' === settings.type ? matchWords(text, matchRegExp, settings) : matchCharacters(text, matchRegExp, settings); |
@@ -0,1 +1,7 @@ | ||
## 2.0.3 (2018-10-29) | ||
### Polish | ||
- Fix: `count` returns 0 for empty strings ([#10602](https://github.com/WordPress/gutenberg/pull/10602)) | ||
## 2.0.0 (2018-09-05) | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "@wordpress/wordcount", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "WordPress word count utility.", | ||
@@ -28,3 +28,3 @@ "author": "The WordPress Contributors", | ||
}, | ||
"gitHead": "0aa5c4340f57a69ab935f9e819d74958aad2e022" | ||
"gitHead": "308f6aa950705531ef9d360dc88bb9f4194542f5" | ||
} |
@@ -95,4 +95,8 @@ import { extend, flow } from 'lodash'; | ||
export function count( text, type, userSettings ) { | ||
const settings = loadSettings( type, userSettings ); | ||
if ( '' === text ) { | ||
return 0; | ||
} | ||
if ( text ) { | ||
const settings = loadSettings( type, userSettings ); | ||
const matchRegExp = settings[ type + 'RegExp' ]; | ||
@@ -99,0 +103,0 @@ const results = ( 'words' === settings.type ) ? |
@@ -88,3 +88,3 @@ /** | ||
{ | ||
message: 'Empty Tags', | ||
message: 'Empty tags', | ||
string: '<p></p>', | ||
@@ -95,2 +95,9 @@ words: 0, | ||
}, | ||
{ | ||
message: 'Empty string', | ||
string: '', | ||
words: 0, | ||
characters_excluding_spaces: 0, | ||
characters_including_spaces: 0, | ||
}, | ||
]; | ||
@@ -97,0 +104,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
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
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88409
981