@wordpress/wordcount
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -83,2 +83,8 @@ /** | ||
* | ||
* @example | ||
* ```js | ||
* import { count } from '@wordpress/wordcount'; | ||
* const numberOfWords = count( 'Words to count', 'words', {} ) | ||
* ``` | ||
* | ||
* @return {Number} The word or character count. | ||
@@ -85,0 +91,0 @@ */ |
@@ -103,2 +103,8 @@ "use strict"; | ||
* | ||
* @example | ||
* ```js | ||
* import { count } from '@wordpress/wordcount'; | ||
* const numberOfWords = count( 'Words to count', 'words', {} ) | ||
* ``` | ||
* | ||
* @return {Number} The word or character count. | ||
@@ -105,0 +111,0 @@ */ |
{ | ||
"name": "@wordpress/wordcount", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "WordPress word count utility.", | ||
@@ -29,3 +29,3 @@ "author": "The WordPress Contributors", | ||
}, | ||
"gitHead": "80d228669adadb8dfcd24b8421517fed3be2d474" | ||
"gitHead": "1e024a20a20369af7bc9720a676fdd3837a3a105" | ||
} |
@@ -15,15 +15,15 @@ # Word Count | ||
## Accepted Parameters | ||
## API | ||
```JS | ||
count( text, type, userSettings ) | ||
```` | ||
count accepts three parameters: | ||
1. text: A string containing the words/characters to be counted. | ||
2. type: A string that represents the type of count. The current implementation accepts the strings 'words', 'characters_excluding_spaces', or 'characters_including_spaces'. | ||
3. userSettings: An object that contains the list of regular expressions that will be used to count. See defaultSettings.js for the defaults. | ||
<!-- START TOKEN(Autogenerated API docs) --> | ||
## Usage | ||
### count | ||
```JS | ||
[src/index.js#L107-L121](src/index.js#L107-L121) | ||
Count some words. | ||
**Usage** | ||
```js | ||
import { count } from '@wordpress/wordcount'; | ||
@@ -33,2 +33,15 @@ const numberOfWords = count( 'Words to count', 'words', {} ) | ||
**Parameters** | ||
- **text** `String`: The text being processed | ||
- **type** `String`: The type of count. Accepts ;words', 'characters_excluding_spaces', or 'characters_including_spaces'. | ||
- **userSettings** `Object`: Custom settings object. | ||
**Returns** | ||
`Number`: The word or character count. | ||
<!-- END TOKEN(Autogenerated API docs) --> | ||
<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p> |
@@ -98,2 +98,8 @@ /** | ||
* | ||
* @example | ||
* ```js | ||
* import { count } from '@wordpress/wordcount'; | ||
* const numberOfWords = count( 'Words to count', 'words', {} ) | ||
* ``` | ||
* | ||
* @return {Number} The word or character count. | ||
@@ -100,0 +106,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1017
46
89007