authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-09-14 21:17:54 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-09-14 21:17:54 -07:00
logd0799b0e4b5cf986473d0041fd5a16cd98ad3852
tree011bc8d14754a852513ec807467824edbe0519fe
parent54487dbd6b08763c681e6494b96279d2d86b86ca

add helper method to get the domain out of a Provider


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

src/lib.zig+9
...@@ -21,6 +21,15 @@ pub const Provider = struct {...@@ -21,6 +21,15 @@ pub const Provider = struct {
21 id_prop: string = "id",21 id_prop: string = "id",
22 logo: string,22 logo: string,
23 color: string,23 color: string,
24
25 pub fn domain(self: Provider) string {
26 if (std.mem.indexOfScalar(u8, self.id, ',')) |_| {
27 var iter = std.mem.split(u8, self.id, ",");
28 _ = iter.next();
29 return iter.next().?;
30 }
31 return self.id;
32 }
24};33};
2534
26pub const Client = struct {35pub const Client = struct {