Concepts
External data adapter
Validate a provider-specific record and project the domain representation.
Formal Syntax & Structure
javascript syntaxjavascript
adapt(raw) → domain recordWorking Example
Example Snippetjavascript
(async () => {function adapt(x){if(typeof x.code!=="string"||!Number.isInteger(x.on_hand)||x.on_hand<0)throw new TypeError("record");return {id:x.code,qty:x.on_hand};}console.log(JSON.stringify(adapt({code:"A",on_hand:4,extra:9})));})()