Skip to content

Commit

Permalink
refactor(ascii): remove unnecessary if-conditional (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
Duologic authored Feb 12, 2024
1 parent 80bdea4 commit 794e8f3
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions ascii.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,17 @@ local d = import 'doc-util/main.libsonnet';
'`isLower` reports whether ASCII character `c` is a lower case letter',
[d.arg('c', d.T.string)]
),
isLower(c):
if cp(c) >= 97 && cp(c) < 123
then true
else false,
isLower(c): cp(c) >= 97 && cp(c) < 123,

'#isUpper':: d.fn(
'`isUpper` reports whether ASCII character `c` is a upper case letter',
[d.arg('c', d.T.string)]
),
isUpper(c):
if cp(c) >= 65 && cp(c) < 91
then true
else false,
isUpper(c): cp(c) >= 65 && cp(c) < 91,

'#isNumber':: d.fn(
'`isNumber` reports whether character `c` is a number.',
[d.arg('c', d.T.string)]
),
isNumber(c):
if std.isNumber(c) || (cp(c) >= 48 && cp(c) < 58)
then true
else false,

isNumber(c): std.isNumber(c) || (cp(c) >= 48 && cp(c) < 58),
}

0 comments on commit 794e8f3

Please sign in to comment.