Skip to content

Commit

Permalink
docs(readme): updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kishor82 committed Apr 29, 2024
1 parent 14339c3 commit bec6b44
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ npm install jsonflat

## Usage

To flata nested JSON object, import the `flatten` function from `jsonflat` and use it as follows:
To flata nested JSON object, import the `flat` function from `jsonflat` and use it as follows:

```javascript
const { flat } = require("jsonflat");
Expand All @@ -37,22 +37,22 @@ const nestedObject = {
},
};

const flattenedObject = flatten(nestedObject);
const flattenedObject = flat(nestedObject);

console.log(flattenedObject);
```

The `flatten` function accepts an optional `delimiter` parameter to customize the separator used in the flattened keys:
The `flat` function accepts an optional `delimiter` parameter to customize the separator used in the flattened keys:

```javascript
const flattenedObject = flatten(nestedObject, ".");
const flattenedObject = flat(nestedObject, ".");

console.log(flattenedObject);
```

## API

### `flatten(inputObject, delimiter = '.')`
### `flat(inputObject, delimiter = '.')`

Flattens the input JSON object to a single level.

Expand Down Expand Up @@ -82,7 +82,7 @@ const nestedObject = {
},
};

const flattenedObject = flatten(nestedObject);
const flattenedObject = flat(nestedObject);

console.log(flattenedObject);
```
Expand Down

0 comments on commit bec6b44

Please sign in to comment.