This function calls a given closure/function with every element in a given struct and returns true, if one of the closure calls returns true
structSome(struct, function(key, value [,struct]){} [, parallel] [, maxThreads])
→ returns boolean
struct.some(function(key, value [,struct]){} [, parallel] [, maxThreads])
key
*
string
:
The key for the current iteration
value
*
any
:
The value for the current iteration
struct
*
struct
:
A reference of the original struct
false
true
false
20
Here we have simple example about structsome function.
<cfscript>
var struct={"Name":"Raja","age":20,"mark":80};
result = structSome(struct,function(key,value){
return key IS "Name"
});
writeOutput((result ? '' : 'No')& " Key Exists.")
</cfscript>
Expected Result: Key Exists.
Here we have simple example about structsome as member function.
<cfscript>
var struct={"Name":"Raja","age":20,"mark":80};
result = struct.some(function(key,value){
return key IS "average"
});
writeOutput((result ? '' : 'No')&" Key Exists.")
</cfscript>
Expected Result: No Key Exists.
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.