Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trycf/e38ea3075468fca05b1ad58f4c31810f to your computer and use it in GitHub Desktop.
Save trycf/e38ea3075468fca05b1ad58f4c31810f to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
NonZeroCounts = StructReduce(TheJSON.data.counts, function(result, key, value) {
if (value > 0) {
result['data'][key] = value;
if (result['data'][key] DOES NOT CONTAIN "warning" && result['data'][key] DOES NOT CONTAIN "error") {
result['tcount'] += value;
}
}
return result;
}, {data:{},tcount: 0}) ;
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment