https://github.com/krzyzanowskim/collectionsafeindex
Get the element at the specified index only if it is within bounds, otherwise nil
https://github.com/krzyzanowskim/collectionsafeindex
swift
Last synced: 4 months ago
JSON representation
Get the element at the specified index only if it is within bounds, otherwise nil
- Host: GitHub
- URL: https://github.com/krzyzanowskim/collectionsafeindex
- Owner: krzyzanowskim
- License: mit
- Created: 2019-06-04T21:55:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-05T01:27:48.000Z (over 6 years ago)
- Last Synced: 2024-04-14T07:11:17.872Z (over 1 year ago)
- Topics: swift
- Language: Swift
- Homepage: https://twitter.com/krzyzanowskim
- Size: 3.91 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# CollectionSafeIndex
Return the element at the specified index only if it is within bounds, otherwise nil.
```swift
let arr = [0,1,2]
let maybe = arr[safe: 3] // nil
```