Skip to content

Commit

Permalink
fix syntax error at README
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Sep 11, 2023
1 parent db76a76 commit 2282ab5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 6.1.2 - 2023-09-10

* [fix sytax error at README](https://github.com/iambumblehead/form-urlencoded/pull/50)


## 6.1.1 - 2023-09-10

* [add support for option 'ignoreEmptyArray',][611] credit @Sanva
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ form-urlencoded
Returns 'x-www-form-urlencoded' string data, an encoding often used when an [HTML form is submitted][1]. Form data is serialised in [this format][2] and sent to a server.

```javascript
import formurlencoded from 'form-urlencoded';
import formurlencoded from 'form-urlencoded'
// or:
// var formurlencoded = require('form-urlencoded');
// var formurlencoded = require('form-urlencoded')

const obj = {
str : 'val',
num : 0,
arr : [3, {prop : false}, 1, null, 6],
obj : {prop1 : null, prop2 : ['elem']}
};
}

console.log(formurlencoded(obj));
console.log(formurlencoded(obj))
// str=val&num=0&arr%5B0%5D=3&arr%5B1%5D%5Bprop%5D=false
// &arr%5B2%5D=1&arr%5B3%5D=null&arr%5B4%5D=6&obj%5Bprop
// 1%5D=null&obj%5Bprop2%5D%5B0%5D=elem
Expand All @@ -27,17 +27,17 @@ console.log(formurlencoded(obj, {
ignorenull : true,
skipIndex : true,
sorted : true
}));
}))
// arr%5B%5D=3&arr%5B%5D%5Bprop%5D=false&arr%5B%5D=1&arr
// %5B%5D=6&num=0&obj%5Bprop2%5D%5B%5D=elem&str=val

console.log(formurlencoded(obj, {
ignoreEmptyArray: true
ignoreEmptyArray: true,
ignorenull : true,
useDot : true,
skipIndex : true,
skipBracket : true
}));
}))
// str=val&num=0&arr=3&arr.prop=false&arr=1&arr=6&obj.pr
// op2=elem
```
Expand Down

0 comments on commit 2282ab5

Please sign in to comment.