@@ -47,7 +47,8 @@ someFunction({
4747```
4848
4949How you can see, ` defineOptions ` ** overwrite original object** .
50- If you need clone object, use spread operator.
50+ If you need clone object, use spread operator or set clone option
51+ in config.
5152
5253# Documentation
5354
@@ -67,6 +68,9 @@ If you need clone object, use spread operator.
6768 1 . [ Type option checker] ( #3-type-option-checker )
6869 1 . [ Type checker] ( #4-type-checker )
6970 1 . [ Validator] ( #5-validator )
71+ 1 . [ Config API] ( #config-api )
72+ 1 . [ mode] ( #mode )
73+ 1 . [ clone] ( #clone )
70741 . [ Using typescript] ( #using-typescript )
7175
7276## ** Settings as array**
@@ -261,6 +265,47 @@ If the validator returns `true` - the script moves to the
261265next property or ends work. But if returns ` false ` - this
262266will result in an error
263267
268+ ## ** Config API**
269+
270+ ### ** mode**
271+
272+ Type: ` strict ` , ` log ` , ` disabled ` \
273+ Default: ` strict `
274+
275+ Mode option needs for changes the way errors are output.
276+
277+ - ** strict** - error will be throw script
278+ - ** log** - error will be output to console
279+ - ** disabled** - error will be ignored
280+
281+ Example:
282+
283+ ``` js
284+ // Error without throw script
285+ defineOptions ({}, [' name' ], { mode: ' log' })
286+ ```
287+
288+ ### ** clone**
289+
290+ Type: ` boolean ` \
291+ Default: ` false `
292+
293+ Clone option needed if you don't want to change the original
294+ options object.
295+
296+ ``` js
297+ const originalObject = {}
298+
299+ const newObject = defineOptions (
300+ originalObject,
301+ { name: { required: false , default: ' Dmitry' } },
302+ { clone: true }
303+ )
304+
305+ console .log (originalObject) // Returns: {}
306+ console .log (newObject) // Returns: { name: 'Dmitry' }
307+ ```
308+
264309## ** Using typescript**
265310
266311If you using typescript, you can use generic type in plugin:
0 commit comments