Skip to content

Commit 0e9473b

Browse files
committed
docs: remove tabs in readme and add meta to package
1 parent 57e8f5a commit 0e9473b

3 files changed

Lines changed: 65 additions & 53 deletions

File tree

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
22
dist/
3+
readme.md

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
"name": "Dmitry Tavern",
77
"url": "https://github.com/DmitryTavern"
88
},
9+
"repository": {
10+
"url": "https://github.com/DmitryTavern/dtavern-options"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/DmitryTavern/dtavern-options/issues"
14+
},
15+
"keywords": [
16+
"options",
17+
"options-parese",
18+
"options-validator"
19+
],
920
"license": "MIT",
1021
"main": "dist/index.js",
1122
"module": "dist/index.esm.js",

readme.md

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,30 @@ npm i @dtavern/options
1818
const { defineOptions } = require('@dtavern/options')
1919

2020
function someFunction(options) {
21-
defineOptions(options, {
22-
name: String,
23-
age: [String, Number],
24-
colors: {
25-
type: Array,
26-
required: false,
27-
default: () => ['red', 'blue'],
28-
validator: (value) => value.length > 0,
29-
},
30-
})
31-
32-
console.log(options)
21+
defineOptions(options, {
22+
name: String,
23+
age: [String, Number],
24+
colors: {
25+
type: Array,
26+
required: false,
27+
default: () => ['red', 'blue'],
28+
validator: (value) => value.length > 0,
29+
},
30+
})
31+
32+
console.log(options)
3333
}
3434

3535
someFunction({
36-
name: 'Rocket',
37-
age: '17',
36+
name: 'Rocket',
37+
age: '17',
3838
})
3939

4040
/* Output:
4141
{
42-
name: 'Rocket',
43-
age: '17',
44-
colors: ['red', 'blue']
42+
name: 'Rocket',
43+
age: '17',
44+
colors: ['red', 'blue']
4545
}
4646
*/
4747
```
@@ -57,17 +57,17 @@ in config.
5757
1. [Set plugin settings as array](#settings-as-array)
5858
1. [Set plugin settings as object](#settings-as-object)
5959
1. [Set options settings as object](#options-settings-as-object)
60-
1. [Option setting API](#option-setting-api)
61-
1. [type](#type)
62-
1. [required](#required)
63-
1. [default](#default)
64-
1. [validator](#validator)
65-
1. [Checkers execution order](#checkers-execution-order)
66-
1. [Exists checker](#1-exists-checker)
67-
1. [Default setter](#2-default-setter)
68-
1. [Type option checker](#3-type-option-checker)
69-
1. [Type checker](#4-type-checker)
70-
1. [Validator](#5-validator)
60+
1. [Option setting API](#option-setting-api)
61+
1. [type](#type)
62+
1. [required](#required)
63+
1. [default](#default)
64+
1. [validator](#validator)
65+
1. [Checkers execution order](#checkers-execution-order)
66+
1. [Exists checker](#1-exists-checker)
67+
1. [Default setter](#2-default-setter)
68+
1. [Type option checker](#3-type-option-checker)
69+
1. [Type checker](#4-type-checker)
70+
1. [Validator](#5-validator)
7171
1. [Config API](#config-api)
7272
1. [mode](#mode)
7373
1. [clone](#clone)
@@ -127,15 +127,15 @@ const { defineOptions } = require('@dtavern/options')
127127

128128
// Returns { name: 'hello' }
129129
defineOptions(
130-
{},
131-
{
132-
name: {
133-
type: String,
134-
required: false,
135-
default: 'hello',
136-
validator: (value) => value.length > 0,
137-
},
138-
}
130+
{},
131+
{
132+
name: {
133+
type: String,
134+
required: false,
135+
default: 'hello',
136+
validator: (value) => value.length > 0,
137+
},
138+
}
139139
)
140140
```
141141

@@ -177,7 +177,7 @@ throw error will not happen
177177

178178
```js
179179
root: {
180-
required: false
180+
required: false
181181
}
182182
```
183183

@@ -297,9 +297,9 @@ options object.
297297
const originalObject = {}
298298

299299
const newObject = defineOptions(
300-
originalObject,
301-
{ name: { required: false, default: 'Dmitry' } },
302-
{ clone: true }
300+
originalObject,
301+
{ name: { required: false, default: 'Dmitry' } },
302+
{ clone: true }
303303
)
304304

305305
console.log(originalObject) // Returns: {}
@@ -320,21 +320,21 @@ Example:
320320
import { defineOptions } from '@dtavern/options'
321321

322322
interface Options {
323-
name?: string
323+
name?: string
324324
}
325325

326326
function someFunction(options: Options = {}) {
327-
// Returns { name: 'hello' }
328-
const newOptions = defineOptions<Options>(options, {
329-
name: {
330-
type: String,
331-
required: false,
332-
default: 'Dmitry',
333-
},
334-
})
335-
336-
// Valid
337-
console.log(newOptions.name)
327+
// Returns { name: 'hello' }
328+
const newOptions = defineOptions<Options>(options, {
329+
name: {
330+
type: String,
331+
required: false,
332+
default: 'Dmitry',
333+
},
334+
})
335+
336+
// Valid
337+
console.log(newOptions.name)
338338
}
339339

340340
someFunction()

0 commit comments

Comments
 (0)