authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-06 16:12:52 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-06 16:12:52 -07:00
logcd255f12edeb9a396afc6a44f88e6c224a8dc8e9
treeb3d7fd6dd425f7e9cc56a895d7acef50790960bd
parent1bb5dc7368098c1cb5384cc4a63b89b05e7865f0

add opslice


1 files changed, 5 insertions(+), 0 deletions(-)

src/lib.zig+5
...@@ -487,3 +487,8 @@ pub fn matchesAll(comptime T: type, haystack: []const u8, comptime needle: fn (T...@@ -487,3 +487,8 @@ pub fn matchesAll(comptime T: type, haystack: []const u8, comptime needle: fn (T
487 }487 }
488 return true;488 return true;
489}489}
490
491pub fn opslice(slice: anytype, index: usize) ?std.meta.Child(@TypeOf(slice)) {
492 if (slice.len <= index) return null;
493 return slice[index];
494}