Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
john-ko committed Sep 20, 2023
1 parent bc17bcf commit f7a4124
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,56 @@
# configurator
easy optional configuration that overlays optional propers over a base or default config

## behavior
```js
import createConfigurator from '@john-ko/configurator'
const config = {
nestedOption: {
somekeys: 'apple',
nestedOptionAgain: {
somekeys: 'banana',
nestedOption: {
somekeyA: 'a',
somekeyB: 'b'
}
}
}
}
const { defineConfig } = createConfigurations(config)

// you can export it out
// export { defineConfig }

// or
const cfg = defineConfig({
nestedOption: {
nestedOptionAgain: {
nestedOption: {
somekeyA: 'AAAAA'
}
}
}
})

//outputs
console.log(JSON.string(cfg))
// {
// "nestedOption": {
// "somekeys": "apple",
// "nestedOptionAgain": {
// "somekeys": "banana",
// "nestedOption": {
// "somekeyA": "AAAAA",
// "somekeyB": "b"
// }
// }
// }
// }
```

## usage

### example
```ts
// config.ts
import createConfigurator from '@john-ko/configurator'
Expand Down Expand Up @@ -45,4 +94,4 @@ import { defineConfig } = './config.js'

/** all options are optional, and will overlay on default config */
export default defineConfig({})
```
```
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"./dist/index.d.ts"
],
"author": "John Ko",
"homepage": "https://github.com/john-ko/configurator/#readme",
"repository": {
"type": "git",
"url": "git@github.com:john-ko/configurator.git"
},
"license": "ISC",
"devDependencies": {
"@types/jest": "^29.5.4",
Expand Down

0 comments on commit f7a4124

Please sign in to comment.