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/52db165752870c25be0db010fc591e70 to your computer and use it in GitHub Desktop.
Save trycf/52db165752870c25be0db010fc591e70 to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
WhatIsTruth('Url.foo not declared');
Url.foo;
WhatIsTruth('Url.foo;');
Url.foo = NullValue();
WhatIsTruth('Url.foo = NullValue();');
Url.foo = "hey";
WhatIsTruth('Url.foo = "hey";');
function WhatIsTruth(header) {
echo('<h1>#header#</h1>');
dump(label='Url', var=Url)
dump(label='IsDefined("Url.foo")', var=IsDefined("Url.foo"));
dump(label='ParameterExists(Url.foo)', var=ParameterExists(Url.foo));
dump(label='StructKeyExists(Url, "foo")', var=StructKeyExists(Url, "foo"));
dump(label='!isNull(Url.foo)', var=!isNull(Url.foo));
dump(label='(Url.foo ?: false) != false)', var=(Url.foo ?: false) != false);
dump(label='(Url.foo ?: false) !== false)', var=(Url.foo ?: false) !== false);
dump(label='Url?.foo != NullValue()', var=Url?.foo != NullValue());
dump(label='Url?.foo !== NullValue()', var=Url?.foo !== NullValue());
echo("<br>");
}
echo('IsDefined("Url.customer")');
timer type="outline" {
loop times=1000000{
IsDefined("Url.customer");
}
}
echo('StructKeyExists(Url, "customer")');
timer type="outline" {
loop times=1000000{
StructKeyExists(Url, "customer");
}
}
echo('ParameterExists(Url.customer)');
timer type="outline" {
loop times=1000000{
ParameterExists(Url.customer);
}
}
echo('!IsNull(url.customer)');
timer type="outline" {
loop times=1000000{
!isNull(url.customer);
}
}
echo('Url.customer ?: false');
timer type="outline" {
loop times=1000000{
Url.customer ?: false;
}
}
echo('(Url.customer ?: false) != false');
timer type="outline" {
loop times=1000000{
(Url.customer ?: false) != false;
}
}
echo('(Url.customer ?: false) !== false');
timer type="outline" {
loop times=1000000{
(Url.customer ?: false) !== false;
}
}
echo('Url?.customer !== NullValue()');
timer type="outline" {
loop times=1000000{
Url?.customer !== NullValue();
}
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment