Re: [w3c/manifest] Use WebIDL to describe the manifest data structure (#611)

I like that approach as a low-level building block. It shouldn't be as much work as IDL given that the space is much more constrained (i.e., we only have object, array, number, string, boolean, or null, and we can trust the input to not cause side effects). And you basically want the same kind of algorithm for each (as @marcoscaceres's code also demonstrates):

1. Let _value_ be the result of getting _property_ from _object_.
2. If _value_ is undefined, then return undefined.
3. If _value_'s _type_ is not _expectedType_, then return undefined.
4. Return _value_.

And then you can define higher-level helpers around that, which perform whitespace normalization, range checks, lone surrogate replacement, array to list concept mapping, etc.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/611#issuecomment-446553336

Received on Wednesday, 12 December 2018 11:21:35 UTC