https://github.com/ryanburnette/array-to-object-template
Convert an array to an object template.
https://github.com/ryanburnette/array-to-object-template
Last synced: 4 months ago
JSON representation
Convert an array to an object template.
- Host: GitHub
- URL: https://github.com/ryanburnette/array-to-object-template
- Owner: ryanburnette
- License: isc
- Created: 2018-03-24T00:42:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-25T17:03:47.000Z (over 7 years ago)
- Last Synced: 2025-02-28T20:02:32.319Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# array-to-object-template
This library is for a specific use case. It goes something like this.
You hand this function an object like this.
```javascript
[ 'date',
{ student: [ 'name', 'cert_number' ] },
{ instructor: [ 'name', 'cert_number', 'cert_expiration', { foo: ['a','b'] } ] },
{ aircraft: [ 'make', 'model' ] } ]
```And it returns a template based on that object, assuming everything should be a
key... like this.```javascript
{
date: null,
student: {
name: null,
cert_number: null
},
instructor: {
name: null,
cert_number: null,
cert_expiration_date: null,
foo: {
a: null,
b: null
}
},
aircraft: {
make: null,
model: null
}
}
```