Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Added NPM support
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkingshott committed Apr 3, 2020
1 parent e70518f commit ca18530
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ The easiest way to pull Iodine into your project is via a CDN:
<script src="https://cdn.jsdelivr.net/gh/mattkingshott/iodine@2/dist/iodine.min.js" defer></script>
```

You can also pull Iodine into your project via NPM:

```js
npm i @kingshott/iodine

import Iodine from '@kingshott/iodine';
```

## Usage

Iodine is automatically added to the `window` namespace, making it available anywhere on the page / within your application.
Expand Down Expand Up @@ -103,7 +111,7 @@ Iodine.getErrorMessage('minimum', 7); // string

## Custom messages (localisation)

You can easily replace the default error messages with your own via the `setErrorMessages` method. This method requires a single parameter, which is an `object` containing the messages. See the [_defaultMessages](src/iodine.js) method for an example of this object.
You can easily replace the default error messages with your own via the `setErrorMessages` method. This method requires a single parameter, which is an `object` containing the messages. See the [_defaultMessages](src/iodine.js) method for an example of this.

Iodine will automatically swap `[PARAM]` placeholders with the parameters supplied in the `getErrorMessage` method. As such, you should insert this placeholder at the appropriate position in your new error message e.g.

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iodine",
"version": "1.0.0",
"name": "@kingshott/iodine",
"version": "2.0.1",
"description": "A micro client-side validation library",
"repository": {
"type": "git",
Expand Down
Binary file modified resources/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions resources/version.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ca18530

Please sign in to comment.