Stone.jsDocs
Paradigm

Primitives

Config

@stone-js/config is a deep store addressed by dotted keys. It is what the Blueprint is built on, and it stands alone for any nested configuration you want to read and write by path, with sensible defaults and deep merging.

#Standalone use

example.tsts
import { Config } from '@stone-js/config'

const config = Config.create({ tasks: { pageSize: 20 }, logger: { level: 'info' } })

config.get('tasks.pageSize', 50)   // 20
config.get('tasks.sort', 'asc')    // 'asc' (default; key absent)
config.has('logger.level')         // true
config.set('tasks.pageSize', 100)  // update by path

#The surface

MemberTypeDescription
Config.create(obj)(obj) => ConfigCreate a store from an object.
get(key, default?)<T>(key, T?) => TRead by dotted key, with a fallback.
set(key, value)(key, value) => thisWrite by dotted key.
has(key)(key) => booleanTest presence by dotted key.
all()() => objectThe whole store.
clear()() => thisEmpty the store.

#The path helpers

The same dotted-path logic is exposed as standalone functions, useful for reading or merging plain objects without a Config instance.

example.tsts
import { getPath, setPath, hasPath, deepMerge } from '@stone-js/config'

getPath(obj, 'a.b.c', fallback)
setPath(obj, 'a.b.c', value)
hasPath(obj, 'a.b.c')
deepMerge(defaults, overrides)

Stone.js

Your app exists in every runtime. Until you run it.

An open-source project by Stone Foundation
Created by Mr. Stone (Evens Pierre)