Skip to content

Commit

Permalink
Readme fixes
Browse files Browse the repository at this point in the history
Added minifier
  • Loading branch information
serbanghita committed Dec 8, 2023
1 parent 0f993dd commit 2cd4d96
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 556 deletions.
47 changes: 21 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
![npm version](https://img.shields.io/npm/v/form_to_object?style=flat-square)
![npm downloads](https://img.shields.io/npm/dm/form_to_object?style=flat-square)



## Install

As a npm package:
Expand All @@ -17,39 +15,36 @@ As a npm package:
npm install form_to_object
```

Inside the HTML code:

```html
<!-- Include minified script (~2kb) -->
<script src="dist/formToObject.min.js"></script>
```js
import formToObject from 'form_to_object';
// or
const formToObject = require('form_to_object');
```

## Usage

Using the DOM node id:
As a JS script:

```js
formToObject('myFormId');
```html
<!-- Include minified script (~6kb) -->
<script src="build/formToObject.js"></script>
```

Using the actual DOM Node reference:
## Example

```js
formToObject(document.getElementById('myFormId'));
```
* Using the DOM node id: `formToObject('myFormId');`
* Using the actual DOM Node reference: `formToObject(document.getElementById('myFormId'));`

Example result:
Resulted value:

```js
```json
{
saveSettings: 'Save',
name: 'Serban',
race: 'orc',
settings: {
input: 'keyboard',
video: {
resolution: '1024x768',
vsync: 'on'
"saveSettings": "Save",
"name": "Serban",
"race": "orc",
"settings": {
"input": "keyboard",
"video": {
"resolution": "1024x768",
"vsync": "on"
}
}
}
Expand Down

0 comments on commit 2cd4d96

Please sign in to comment.