33 hints : [
44 {
55 absent : ", $" ,
6- text : "This is a parameter, it must end with a comma."
6+ text : "This is a parameter, it must end with a comma." ,
7+ examples : [
8+ [ "" ] ,
9+ [ " query('id')" ] ,
10+ ] ,
711 } ,
812 {
913 absent : String . raw `query \( ["'${ BACKQUOTE } ]id["'${ BACKQUOTE } ] \)` ,
10- text : "Use query() with an 'id' parameter."
14+ text : "Use query() with an 'id' parameter." ,
15+ examples : [
16+ [ " query()," ] ,
17+ ] ,
1118 } ,
1219 {
1320 present : String . raw `query \( ["'${ BACKQUOTE } ]id["'${ BACKQUOTE } ] \) [^. ]` ,
14- text : "After query(\"id\") use a period to invoke a verification method."
21+ text : "After query(\"id\") use a period to invoke a verification method." ,
22+ examples : [
23+ [ " query('id')," ] ,
24+ ] ,
1525 } ,
1626 {
1727 present : "(islength|Islength|IsLength|ISLENGTH)" ,
18- text : "JavaScript is case-sensitive. Use isLength instead of the case you have."
28+ text : "JavaScript is case-sensitive. Use isLength instead of the case you have." ,
29+ examples : [
30+ [ " query('id').IsLength({max: 80})," ] ,
31+ ] ,
1932 } ,
2033 {
2134 absent : "isLength" ,
22- text : "Use isLength()."
35+ text : "Use isLength()." ,
36+ examples : [
37+ [ " query('id').length({max: 80})," ] ,
38+ ] ,
2339 } ,
2440 {
2541 present : String . raw `isLength \( [a-z]` ,
26- text : "You need to pass isLength() an object within {...}."
42+ text : "You need to pass isLength() an object within {...}." ,
43+ examples : [
44+ [ " query('id').isLength(max: 80)," ] ,
45+ ] ,
2746 } ,
2847 {
2948 absent : "matches" ,
30- text : "Use matches()."
49+ text : "Use matches()." ,
50+ examples : [
51+ [ " query('id').isLength({max: 80})," ] ,
52+ ] ,
3153 } ,
3254 {
3355 present : String . raw `matches \( /[^^]` ,
34- text : "Match the whole string - begin the regular expression with ^"
56+ text : "Match the whole string - begin the regular expression with ^" ,
57+ examples : [
58+ [ " query('id').isLength({max: 80}).matches(//)," ] ,
59+ ] ,
3560 } ,
3661 {
3762 present : String . raw `matches \( /[^$/]*[^$]/` ,
38- text : "Match the whole string - end the regular expression with $"
39- } ,
40- {
41- present : String . raw `matches \( /[^$/]*[^$]/` ,
42- text : "Match the whole string - end the regular expression with $"
63+ text : "Match the whole string - end the regular expression with $" ,
64+ examples : [
65+ [ " query('id').isLength({max: 80}).matches(/^/)," ] ,
66+ ] ,
4367 } ,
4468 {
4569 present : String . raw `matches \( /\^\[A-Z\]-` ,
46- text : "That would match only one letter before the dash, you need two."
70+ text : "That would match only one letter before the dash, you need two." ,
71+ examples : [
72+ [ " query('id').isLength({max: 80}).matches(/^[A-Z]-\d+-\d+$/)," ] ,
73+ ] ,
4774 } ,
4875 {
4976 present : String . raw `matches \( /.*(\[0-9\]|\d)\*` ,
50- text : "You need to match one or more digits; * allows 0 or more. A + would be better suited for this task."
77+ text : "You need to match one or more digits; * allows 0 or more. A + would be better suited for this task." ,
78+ examples : [
79+ [ " query('id').isLength({max: 80}).matches(/^[A-Z]{2}-[0-9]*-\d*$/)," ] ,
80+ ] ,
5181 } ,
5282 {
5383 present : String . raw `\s*, , $` ,
54- text : "You have two commas at the end. Use only one. You may need to scroll or increase the text area to see both of them."
84+ text : "You have two commas at the end. Use only one. You may need to scroll or increase the text area to see both of them." ,
85+ examples : [
86+ [
87+ "query('id').isLength({max:80}).matches( /^[A-Z]{2}-[0-9]+-[0-9]+$/ ), ," ,
88+ ] ,
89+ ] ,
5590 } ,
5691 ] ,
5792 expected : [
@@ -73,27 +108,27 @@ info =
73108 ] ,
74109 successes : [
75110 [
76- "query(`id`).isLength( {max:80}).matches(/^[A-Z]{2}-\\d+-[0-9]+$/),"
111+ "query(`id`).isLength( {max:80}).matches(/^[A-Z]{2}-\\d+-[0-9]+$/)," ,
77112 ] ,
78113 [
79- " query (`id`) . isLength( {max:80}).matches(/^[A-Z]{2}-\\d+-[0-9]+$/ ) , "
114+ " query (`id`) . isLength( {max:80}).matches(/^[A-Z]{2}-\\d+-[0-9]+$/ ) , " ,
80115 ] ,
81116 ] ,
82117 failures : [
83118 [
84- "query('id').isLength({max:80}).matches( /^[A-Z]{2}-[0-9]+- [0-9]+$/ ),"
119+ "query('id').isLength({max:80}).matches( /^[A-Z]{2}-[0-9]+- [0-9]+$/ )," ,
85120 ] ,
86121 [
87- "query('id').isLength().matches( /^[A-Z]{2}-[0-9]+-[0-9]+$/ ),"
122+ "query('id').isLength().matches( /^[A-Z]{2}-[0-9]+-[0-9]+$/ )," ,
88123 ] ,
89124 [
90- "query('id').isLength({max:80}).matches( /[A-Z]{2}-[0-9]+-[0-9]+/ ),"
125+ "query('id').isLength({max:80}).matches( /[A-Z]{2}-[0-9]+-[0-9]+/ )," ,
91126 ] ,
92127 [
93- "query(`id`).isLength( {max:80}).matches(/^[A-Z]{2}-\\d+-[0-9]+$/)"
128+ "query(`id`).isLength( {max:80}).matches(/^[A-Z]{2}-\\d+-[0-9]+$/)" ,
94129 ] ,
95130 [
96- "query(`id`).isLength( {max:80}).matches(/^[A-Z]{2}- \\d+-[0-9]+$/),"
131+ "query(`id`).isLength( {max:80}).matches(/^[A-Z]{2}- \\d+-[0-9]+$/)," ,
97132 ] ,
98133 ] ,
99134} ;
0 commit comments