guard.cr
guard
Add Swift's guard clause as a macro to Crystal.
Installation
-
Add the dependency to your
shard.yml:dependencies: guard: github: nobodywasishere/guard -
Run
shards install
Usage
require "guard"
def normalize(value : Int32?)
guard value do
return 0
end
value
end
normalize(1) # => 1
normalize(nil) # => 0
Contributing
- Fork it (https://github.com/nobodywasishere/guard/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Margret Riegert - creator and maintainer
Repository
guard.cr
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- over 2 years ago
- September 30, 2023
License
MIT License
Links
Synced at
Tue, 27 Jan 2026 07:52:10 GMT
Languages