Skip to content

Commit

Permalink
Provide keyMirrorPrefix function as a default import 🌸 (#2)
Browse files Browse the repository at this point in the history
* Provide keyMirrorPrefix function as a default import 🌸

* Bump version 🆙

* Updated README.md 📘
  • Loading branch information
01taylop committed May 27, 2024
1 parent e0a72de commit 49c1587
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Key Mirror Prefix is a utility for creating an object with values equal to its k
- [Motivation](#motivation)
- [Example](#example)
- [Usage](#usage)
- [Installation](#installation)
- [Importing](#importing)
- [Example Usage](#example-usage)

## Motivation

Expand Down Expand Up @@ -49,6 +52,8 @@ This makes it clear whether the `SEARCH_SUCCESS` action came from `CITIES` or `C

## Usage

### Installation

First, install the package as a dependency:

```bash
Expand All @@ -59,7 +64,9 @@ yarn add keymirrorprefix
npm install keymirrorprefix
```

Then, you can import `keyMirrorPrefix` using either CommonJS or ES Modules:
### Importing

You can import `keyMirrorPrefix` using either CommonJS or ES Modules:

For CommonJS:

Expand All @@ -73,6 +80,10 @@ For ES Modules:
import { keyMirrorPrefix } from 'keymirrorprefix'
```

The `keyMirrorPrefix` function is exported both as a default and named export, so you can import it either way.

### Example Usage

Once you've imported `keyMirrorPrefix`, you can use it to create an object with keys mirrored as values, prefixed with a specified string:

```js
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "git",
"url": "https://github.com/01taylop/key-mirror-prefix"
},
"version": "1.0.0",
"version": "1.0.1",
"type": "module",
"main": "./lib/index.js",
"exports": {
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ export {
keyMirror,
keyMirrorPrefix,
}

export default keyMirrorPrefix

0 comments on commit 49c1587

Please sign in to comment.