tien opened a new pull request, #2599:
URL: https://github.com/apache/tinkerpop/pull/2599
- Improve structures type definitions
- Add fully type safe utility to easily parse and interact with vertex
properties:
```ts
const rawVertex = {
id: 0,
label: 'thing',
properties: {
name: [{ id: 0, label: 'name', key: 'name', value: 'Foo' }],
alias: [
{ id: 0, label: 'alias', key: 'alias', value: 'Bar' },
{ id: 0, label: 'alias', key: 'alias', value: 'Baz' },
],
scores: [
{ id: 0, label: 'score', key: 'score', value: 4 },
{ id: 0, label: 'score', key: 'score', value: 20 },
],
},
};
const vertex = parseVertex(rawVertex, {
// Optional
name: 'single',
alias: 'list',
});
console.log(vertex); // Output: { name: 'Foo', alias: ['Bar', 'Baz'],
scores: Set [ 4, 20 ] }
```
I'm calling `parseVertex` for now, but let me know if another name would
make better sense.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]