@@ -52,7 +52,7 @@ const properties = getAllFiles(ecsSchemasDir)
52
52
. map ( file => fs . readFileSync ( file , 'utf8' ) )
53
53
. map ( yaml . safeLoad )
54
54
. reduce ( ( acc , [ val ] ) => {
55
- var properties = { }
55
+ let properties = { }
56
56
for ( const prop of val . fields ) {
57
57
properties = set ( properties , prop . name , jsonSchemaTypeFromEcsType ( prop . type ) )
58
58
}
@@ -68,12 +68,12 @@ const properties = getAllFiles(ecsSchemasDir)
68
68
} , { } )
69
69
70
70
// Write out a JSON schema file.
71
- const gitInfo = execSync ( ` git log -1 --pretty=format:'commit %h%d'` , {
71
+ const gitInfo = execSync ( ' git log -1 --pretty=format:\ 'commit %h%d\'' , {
72
72
cwd : ecsRepo
73
73
} )
74
74
const comment = `ecs.git ${ gitInfo } `
75
75
const jsonSchema = JSON . stringify ( {
76
- ' $comment' : comment ,
76
+ $comment : comment ,
77
77
type : 'object' ,
78
78
properties,
79
79
additionalProperties : true
@@ -95,17 +95,17 @@ function set (object, objPath, value, customizer) {
95
95
. split ( '.' )
96
96
. join ( '.properties.' )
97
97
. split ( '.' )
98
- var index = - 1
99
- var length = objPath . length
100
- var lastIndex = length - 1
101
- var nested = object
98
+ let index = - 1
99
+ const length = objPath . length
100
+ const lastIndex = length - 1
101
+ let nested = object
102
102
103
103
while ( nested != null && ++ index < length ) {
104
- var key = objPath [ index ]
105
- var newValue = value
104
+ const key = objPath [ index ]
105
+ let newValue = value
106
106
107
107
if ( index !== lastIndex ) {
108
- var objValue = nested [ key ]
108
+ const objValue = nested [ key ]
109
109
newValue = objValue || { }
110
110
}
111
111
if ( key === 'properties' ) {
@@ -158,7 +158,7 @@ function jsonSchemaTypeFromEcsType (type) {
158
158
}
159
159
}
160
160
161
- function usageError ( msg ) {
161
+ function usageError ( msg ) {
162
162
const prog = path . basename ( process . argv [ 1 ] )
163
163
process . stderr . write ( `${ prog } : error: ${ msg } \n` )
164
164
process . stderr . write ( 'usage: node create-schema $ecsRepo\n' )
0 commit comments