Add Helper 'index': get elem of array with the index
This commit is contained in:
		| @@ -25,7 +25,7 @@ | ||||
| {{abbrev 5 "hello world"}}:                                                         he... | ||||
| {{abbrevboth 5 10 "1234 5678 9123"}}:                                               ...5678... | ||||
| {{initials "First Try"}}:                                                           FT | ||||
| {{randNumeric 3}}:                                                                  146 | ||||
| {{randNumeric 3}}:                                                                  528 | ||||
| {{- /*{{wrap 80 $someText}}*/}}: | ||||
| {{wrapWith 5 "\t" "Hello World"}}:                                                  Hello	World | ||||
| {{contains "cat" "catch"}}:                                                         true | ||||
| @@ -45,6 +45,9 @@ | ||||
| {{regexReplaceAllLiteral "a(x*)b" "-ab-axxb-" "${1}"}}:                             -${1}-${1}- | ||||
| {{regexSplit "z+" "pizza" -1}}:                                                     [pi a] | ||||
|  | ||||
| # Get one specific method on array method using index | ||||
| {{ index .Service.Method 1 }}:                                                      name:"Iii" input_type:".dummy.Dummy2" output_type:".dummy.Dummy1" options:<>  | ||||
|  | ||||
| # Sprig: advanced | ||||
| {{if contains "cat" "catch"}}yes{{else}}no{{end}}:   yes | ||||
| {{1 | plural "one anchovy" "many anchovies"}}:       one anchovy | ||||
|   | ||||
| @@ -46,6 +46,9 @@ | ||||
| {{`{{regexReplaceAllLiteral "a(x*)b" "-ab-axxb-" "${1}"}}`}}:                             {{regexReplaceAllLiteral "a(x*)b" "-ab-axxb-" "${1}"}} | ||||
| {{`{{regexSplit "z+" "pizza" -1}}`}}:                                                     {{regexSplit "z+" "pizza" -1}} | ||||
|  | ||||
| # Get one specific method on array method using index | ||||
| {{`{{ index .Service.Method 1 }}`}}:                                                      {{ index .Service.Method 1 }} | ||||
|  | ||||
| # Sprig: advanced | ||||
| {{`{{if contains "cat" "catch"}}yes{{else}}no{{end}}`}}:   {{if contains "cat" "catch"}}yes{{else}}no{{end}} | ||||
| {{`{{1 | plural "one anchovy" "many anchovies"}}`}}:       {{1 | plural "one anchovy" "many anchovies"}} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user