File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 103103 <block type =" lists_get" />
104104 <block type =" lists_index" />
105105 <block type =" lists_length" />
106+ <block type =" lists_contains" />
106107 <sep gap =" 48" ></sep >
107108 <block type =" lists_set" />
108109 <block type =" lists_join" />
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ function register() {
8585 }
8686 ] ,
8787 inputsInline : true ,
88- output : null ,
88+ output : "Number" ,
8989 colour : categoryColor ,
9090 } , ( block ) => {
9191 const VALUE = javascriptGenerator . valueToCode ( block , 'VALUE' )
@@ -94,6 +94,32 @@ function register() {
9494 return [ `${ code } ` , 0 ] ;
9595 } )
9696
97+ registerBlock ( `${ categoryPrefix } contains` , {
98+ message0 : '%1 contains %2' ,
99+ args0 : [
100+ {
101+ "type" : "input_value" ,
102+ "name" : "INPUT" ,
103+ "check" : "List"
104+ } ,
105+ {
106+ "type" : "field_input" ,
107+ "name" : "VALUE" ,
108+ "check" : null ,
109+ "value" : "" ,
110+ "acceptsBlocks" : true
111+ } ,
112+ ] ,
113+ inputsInline : true ,
114+ output : "Boolean" ,
115+ colour : categoryColor ,
116+ } , ( block ) => {
117+ const VALUE = javascriptGenerator . valueToCode ( block , 'VALUE' )
118+ const INPUT = javascriptGenerator . valueToCode ( block , 'INPUT' )
119+ const code = `(${ INPUT } .includes(${ VALUE } ))` ;
120+ return [ `${ code } ` , 0 ] ;
121+ } )
122+
97123 registerBlock ( `${ categoryPrefix } set` , {
98124 message0 : 'set item %1 of %2 to %3' ,
99125 args0 : [
You can’t perform that action at this time.
0 commit comments