mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-06-19 06:25:58 +08:00
docs: fix index-of api reference
This commit is contained in:
@@ -1134,10 +1134,10 @@ In Clarity1, `element-at` must be used (without the `?`). The `?` is added in Cl
|
||||
|
||||
const INDEX_OF_API: SpecialAPI = SpecialAPI {
|
||||
input_type: "sequence_A, A",
|
||||
snippet: "index-of ${1:sequence} ${2:item}",
|
||||
snippet: "index-of? ${1:sequence} ${2:item}",
|
||||
output_type: "(optional uint)",
|
||||
signature: "(index-of sequence item)",
|
||||
description: "The `index-of` function returns the first index at which `item` can be
|
||||
signature: "(index-of? sequence item)",
|
||||
description: "The `index-of?` function returns the first index at which `item` can be
|
||||
found, using `is-eq` checks, in the provided sequence.
|
||||
Applicable sequence types are `(list A)`, `buff`, `string-ascii` and `string-utf8`,
|
||||
for which the corresponding element types are, respectively, `A`, `(buff 1)`, `(string-ascii 1)` and `(string-utf8 1)`.
|
||||
@@ -1146,11 +1146,11 @@ supplied), this function returns `none`.
|
||||
In Clarity1, `index-of` must be used (without the `?`). The `?` is added in Clarity2 for consistency -- built-ins that return responses or optionals end in `?`. The Clarity1 spelling is left as an alias in Clarity2 for backwards compatibility.
|
||||
",
|
||||
example: r#"
|
||||
(index-of "blockstack" "b") ;; Returns (some u0)
|
||||
(index-of "blockstack" "k") ;; Returns (some u4)
|
||||
(index-of "blockstack" "") ;; Returns none
|
||||
(index-of (list 1 2 3 4 5) 6) ;; Returns none
|
||||
(index-of 0xfb01 0x01) ;; Returns (some u1)
|
||||
(index-of? "blockstack" "b") ;; Returns (some u0)
|
||||
(index-of? "blockstack" "k") ;; Returns (some u4)
|
||||
(index-of? "blockstack" "") ;; Returns none
|
||||
(index-of? (list 1 2 3 4 5) 6) ;; Returns none
|
||||
(index-of? 0xfb01 0x01) ;; Returns (some u1)
|
||||
"#,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user