Skip to content

Commit e116a49

Browse files
author
Yury Shapkarin
committed
much much better regexp
1 parent 1ee745b commit e116a49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bin/initialize.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ program
221221

222222
for (prop of propNames){
223223
if(/:/.test(prop)){
224-
const match = prop.match(/^[a-z0-9]+|(?<=:).[a-z0-9]+|\*/ig);
225-
const key = match[0] + (match[2] ? '*' : '');
226-
result[key] = match[1]
224+
const [name, type, required ] = prop.match(/^[a-z0-9]+|(?<=:).[a-z0-9]+|\*/ig);
225+
const key = name + (required ? '*' : '');
226+
result[key] = type
227227
}
228228
}
229229

0 commit comments

Comments
 (0)