.fetch()

Returns the value of the provided key directly from the JSON file.

fetch(key)

db.set('Greeting', 'Hello World'); // 'Hello World'

db.fetch('Greeting'); // 'Hello World'

Also allows the use of dot notation:

db.set('user', { name: 'Peter', age: 19 }); // { name: 'Peter', age: 19 }

db.fetch('user.name'); // 'Peter'
db.fetch('user.age'); // 19
db.fetch('user.hobbies'); // undefined

Last updated