Add support for collection keys in toObject.

This commit is contained in:
Joshua Bemenderfer
2023-01-30 20:59:10 -05:00
parent aebe488dad
commit 4105eb7e0d
4 changed files with 92 additions and 55 deletions

View File

@@ -40,7 +40,11 @@ const lines = [
` Further comments below. As I will now demonstrate, there is no simple`,
` even if embedded`,
` way of dealing with this problem.`,
``
`author`,
` name Second Person`,
` email second@secondperson.com`,
` More text,`,
` across two lines.`,
]
// Schema
@@ -76,7 +80,10 @@ async function main() {
}),
'scripts': () => toObject({ '#any': true }),
'devDependencies': () => toObject(),
'author': () => toObject({ name: true, email: true, '#text': true })
'author': {
type: 'collection',
handle: () => toObject({ name: true, email: true, '#text': true })
}
})
console.dir(structure, { depth: null })