Skip to content

Commit

Permalink
docs(api): add api documentation (#41)
Browse files Browse the repository at this point in the history
* docs(api): add api documentation

* chore: force eol style
  • Loading branch information
Fdawgs authored Feb 6, 2025
1 parent 3796127 commit 102803c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
npm run lint:licenses && npm test
npm run lint:licenses && npm test
npm run build:docs && git add API.md
36 changes: 36 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## Constants

<dl>
<dt><a href="#replacements">replacements</a> : <code>Record.&lt;string, string&gt;</code></dt>
<dd><p>Object containing Latin-1 characters and their corresponding UTF-8 characters.</p>
</dd>
</dl>

## Functions

<dl>
<dt><a href="#fixLatin1ToUtf8">fixLatin1ToUtf8(str)</a> ⇒ <code>string</code></dt>
<dd><p>Fixes common encoding errors when converting from Latin-1 (and Windows-1252) to UTF-8.</p>
</dd>
</dl>

<a name="replacements"></a>

## replacements : <code>Record.&lt;string, string&gt;</code>
Object containing Latin-1 characters and their corresponding UTF-8 characters.

**Kind**: global constant
<a name="fixLatin1ToUtf8"></a>

## fixLatin1ToUtf8(str) ⇒ <code>string</code>
Fixes common encoding errors when converting from Latin-1 (and Windows-1252) to UTF-8.

**Kind**: global function
**Returns**: <code>string</code> - The converted string.
**See**: [ UTF-8 Encoding Debugging Chart](http://www.i18nqa.com/debug/utf8-debug.html)
**Author**: Frazer Smith

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | The string to be converted. |

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ Install using `npm`:
npm i fix-latin1-to-utf8
```

## Example usage
## API

API documentation can be found [here](https://github.com/Fdawgs/fix-latin1-to-utf8/blob/main/API.md).

Please refer to the [JSDoc comments in the source code](./src/index.js) or the [generated type definitions](https://www.npmjs.com/package/fix-latin1-to-utf8?activeTab=code) for information on the available options.
## Example usage

```js
const fixLatin1ToUtf8 = require("fix-latin1-to-utf8");
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
},
"scripts": {
"build": "tsc",
"build:docs": "jsdoc2md src/index.js > API.md --EOL posix",
"lint": "eslint . --cache --ext js,jsx --ignore-path .gitignore",
"lint:fix": "npm run lint -- --fix",
"lint:licenses": "node scripts/license-checker.js",
Expand Down Expand Up @@ -60,6 +61,7 @@
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-security": "^3.0.1",
"husky": "^9.1.7",
"jsdoc-to-markdown": "^9.1.1",
"license-checker": "^25.0.1",
"prettier": "^3.4.2",
"spdx-copyleft": "^1.0.0",
Expand Down

0 comments on commit 102803c

Please sign in to comment.