WWL JS Utils
Current Version | Master | Develop |
---|---|---|
settings
Loading configurations/settings over cookie or script tag or by passing in the config directly.
Options
new require'wwl-js-utils/lib/settings' # one of those is required: data: test: 1 cookieKey: 'id-of-config-cookie-key' selectorId: 'id-of-config-script-tag' # optional: defaults: some: 'defaults' # default: {} base64: false # default: false removeAfterParse: true # default: true
If you pass in data
, selectorId
and cookieKey
, data
will be used. If you pass selectorId
and cookieKey
, cookieKey
will be used.
Getting config attributes
data = a: b: 1 c: d: '2' e: f: 4 g: false config = new require'wwl-js-utils/settings' data: data configget'a'b # 1 configget'a'cd # '2' configget'a'ef # 4 configget'a'eg # false configget'a.b' # 1 configget'a.c.d' # '2' configget'a.e.f' # 4 configget'a.e.g' # false