Registry / storage / yam
library1.0.0jsnpmunverified

Dead simple lazy storage interface for CLI or project settings. v1.0.0 (latest, 2017) intended for Node.js (^4.5 || 6.* || >= 7.*). Parses JSON files with comments; supports primary (project) and secondary (home) directory lookup. No active development; no major alternatives mentioned. Minimal API: constructor, get, getAll.

npm install yam
INSTALL
IMPORT
SIG · YAM
Y
yam
storagejavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Yam
const Yam = require('yam');
import Yam from 'yam';
Package uses CommonJS only; ESM import will fail.

Demonstrates creating a Yam instance, setting and getting values from a JSON config file.

const Yam = require('yam'); // Create instance looking for '.config' file const yam = new Yam('config'); // Set a value const fs = require('fs-extra'); fs.outputJsonSync('.config', { foo: 'bar' }); // Get a value const value = yam.get('foo'); console.log(value); // 'bar' // Get all values const all = yam.getAll(); console.log(all); // { foo: 'bar' }
Debug
Known issues
gotchaConstructor name must match filename pattern: new Yam('test') looks for '.test' file.
fix
Use the exact filename (without dot) to search for the corresponding .<name> file.
affects: >=1.0.0
gotchaOnly supports JSON with comments (non-standard). Standard JSON will fail silently if malformed.
fix
Ensure file is valid JSON with // or /* */ comments, or use a standard JSON parser.
affects: >=1.0.0
deprecatedPackage is unmaintained; no updates since 2017. Security vulnerabilities may exist.
fix
Consider using an alternative like 'configstore' or 'env-paths'.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'yam'
Missing dependency or incorrect installation.
fix
Run 'npm install yam' in your project directory.
TypeError: yam.get is not a function
Yam instance not created correctly or using wrong import style.
fix
Ensure you used 'const Yam = require('yam');' and then 'const yam = new Yam('name');'.
Unexpected token / in JSON at position 0
Trying to parse a file with JavaScript comments using JSON.parse directly.
fix
Use Yam's get() method to read the file; it supports comments. Or use yam's internal parsing.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
fs-extrarequiredUsed for file system operations; listed as dependency.
Agent activity
23 hits · last 30 days
node
22
Resources
packageyam
yam — npm install yam · libregistry