Skip to content

Commit 1f34dfe

Browse files
committed
Updated README.md
1 parent be9607b commit 1f34dfe

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

README.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,60 +11,51 @@
1111

1212
## Installation
1313

14-
Node.js:
14+
via npm:
1515

1616
```shell
17-
npm install jquery-param --save
18-
```
19-
20-
the browser:
21-
22-
```html
23-
<script src="/path/to/jquery-param.min.js"></script>
17+
npm i jquery-param
2418
```
2519

2620
## Usage
2721

28-
CommonJS:
29-
3022
```javascript
31-
const param = require('jquery-param');
23+
import param from 'jquery-param';
3224

3325
const obj = { key1: { value1: [10, 20, 30] }, key2: '?a=b&c=d' };
3426
const str = param(obj);
3527
// => "key1[value1][]=10&key1[value1][]=20&key1[value1][]=30&key2=?a=b&c=d"
3628
```
3729

38-
TypeScript:
30+
CommonJS:
3931

4032
```javascript
41-
import param from 'jquery-param';
33+
const param = require('jquery-param');
4234

4335
const obj = { key1: { value1: [10, 20, 30] }, key2: '?a=b&c=d' };
4436
const str = param(obj);
4537
// => "key1[value1][]=10&key1[value1][]=20&key1[value1][]=30&key2=?a=b&c=d"
4638
```
4739

48-
*You will need to add `"esModuleInterop": true` to the `"compilerOptions"` field in `tsconfig.json`.*
49-
50-
ES Modules:
40+
ES Modules (Browser):
5141

5242
```html
5343
<script type="module">
54-
import param from './esm/jquery-param.es.js';
44+
import param from '/path/to/jquery-param.js';
5545
5646
const obj = { key1: { value1: [10, 20, 30] }, key2: '?a=b&c=d' };
5747
const str = param(obj);
5848
// => "key1[value1][]=10&key1[value1][]=20&key1[value1][]=30&key2=?a=b&c=d"
5949
</script>
6050
```
6151

62-
Older browser:
52+
Traditional (Browser):
6353

6454
```html
55+
<script src="/path/to/jquery-param.js">
6556
<script>
6657
var obj = { key1: { value1: [10, 20, 30] }, key2: '?a=b&c=d' };
67-
var str = window.param(obj); // global object
58+
var str = window.param(obj);
6859
// => "key1[value1][]=10&key1[value1][]=20&key1[value1][]=30&key2=?a=b&c=d"
6960
</script>
7061
```

0 commit comments

Comments
 (0)