From 83363c9c24e846491b7f546f20365e7afe1b5359 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 18 Oct 2018 09:06:42 +0200 Subject: Add some documentation --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 960b809..e5ec252 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,22 @@ parseAttr('{ width=500px editable=true #unicorn .dangerous .cute }'); } ``` +### Advanced usage + +The parsing can start at a positive offset. + +```js +parseAttr('SYNTAX{ width=500px editable=true }', len('SYNTAX')); +``` + +A configuration can also be specified, actualy, there is only one configuration option. +The default value of key without value. + +```js +parseAttr('{ width=500px editable }', 0, {defaultValue: true}); +// or +parseAttr('{ width=500px editable }', 0, {defaultValue: key => 'NO_VALUE_FOR_'+key.toUpperCase()}); +``` ## Licence -- cgit v1.2.3