simple example of conversion functions
- Dominant language
- JavaScript
- Stars
- 132
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
# not final, food for thought.
Want output
```
{
'name': 'Juan Batiz-Benet'
'city': 'San Francisco, CA'
}
```
Input Type FOO
```
{
'name': {
'@type': 'pandat/name',
'label': 'NAME',
'codec': 'pandat/name-last-name-first'
},
'addr': {
'@type': 'pandat/us-street-address',
'label': 'ADDR',
}
}
```
Output Type BAR
```
{
'name': 'pandat/name',
'city': 'pandat/us-city',
}
```
You can write a conversion function, use it and/or publish it to pandat:
(excuse this interface, might be simplified some)
```
var Foo2Bar = pandat.Conversion({'invertible': 'false'}, [Foo], [Bar]);
Foo2Bar.convert = function(foo) {
return {
'name': pandat(Foo.name['@type'], Bar.name['@type'], foo.name),
'city': pandat(Foo.addr['@type'], Bar.city['@type'], foo.addr)
}
}
```
Or, pandat might be able to generate the function, with some hints about how the names map to each other. (not quite sure what the right interface is here, but will think about it.)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.