FaasJS Utils And Data
Default Workflow
- Use the smallest helper that matches the payload shape.
- Keep JSON helpers paired with JSON payloads and text helpers paired with text streams.
- Use Zod schemas for external data validation and helper type guards for unknown internal values.
- Use
parseYaml()for direct YAML parsing; useloadConfig()when staged FaasJS config discovery is required. - Validate root-scoped paths before file access in Node-side tooling.
Load These References
- Portable helpers and quick selection rules:
references/guidelines/utils.md. - JSON parsing and JSON stream helpers:
references/guidelines/json.md. - Direct YAML parsing:
references/guidelines/yaml.md. - Zod helpers, object narrowing, schema parsing, and path containment:
references/guidelines/valid.md.
Gotchas
- Do not replace internal control-flow checks with Zod schemas.
objectToStreampairs withstreamToObject;stringToStreampairs withstreamToString.- Use
loadConfig()instead of direct YAML parsing when config staging and merge order matter.
Validation
- Run focused unit tests with
vp test <pattern>for helper behavior changes. - Run
vp check --fixbefore handoff when utility files changed.