Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Mar 6, 2019
1 parent fd32135 commit 830d9ca
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/html-entities/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,24 @@ _This package assumes that your code will run in an **ES2015+** environment. If

### decodeEntities

[src/index.js#L3-L22](src/index.js#L3-L22)
[src/index.js#L16-L35](src/index.js#L16-L35)

Undocumented declaration.
Decodes the HTML entities from a given string.

**Usage**

```js
const result = decodeEntities( 'á' );
console.log( result ); // result will be "á"
```

**Parameters**

- **html** `string`: String that contain HTML entities.

**Returns**

`string`: The decoded string.


<!-- END TOKEN(Autogenerated API docs) -->
Expand Down
13 changes: 13 additions & 0 deletions packages/html-entities/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
let _decodeTextArea;

/**
* Decodes the HTML entities from a given string.
*
* @param {string} html String that contain HTML entities.
*
* @example
* ```js
* const result = decodeEntities( '&aacute;' );
* console.log( result ); // result will be "á"
* ```
*
* @return {string} The decoded string.
*/
export function decodeEntities( html ) {
// not a string, or no entities to decode
if ( 'string' !== typeof html || -1 === html.indexOf( '&' ) ) {
Expand Down

0 comments on commit 830d9ca

Please sign in to comment.