UNPKG

8.18 kBPlain TextView Raw
1/*
2 * Generated type guards for "index.ts".
3 * WARNING: Do not manually change this file.
4 */
5import { AtomFeed, AtomGenerator, AtomEntry, AtomSource, AtomCategory, AtomContent, AtomLink, AtomPerson, AtomLinkRelType, AtomAuthor, AtomContributor, AtomText, AtomTextType, AtomTitle, AtomSummary, AtomRights } from "./index";
6
7export function isAtomFeed(obj: any, _argumentName?: string): obj is AtomFeed {
8 return (
9 (obj !== null &&
10 typeof obj === "object" ||
11 typeof obj === "function") &&
12 typeof obj.id === "string" &&
13 isAtomTitle(obj.title) as boolean &&
14 obj.updated instanceof Date &&
15 Array.isArray(obj.entries) &&
16 obj.entries.every((e: any) =>
17 isAtomEntry(e) as boolean
18 ) &&
19 (typeof obj.author === "undefined" ||
20 Array.isArray(obj.author) &&
21 obj.author.every((e: any) =>
22 isAtomAuthor(e) as boolean
23 )) &&
24 (typeof obj.link === "undefined" ||
25 Array.isArray(obj.link) &&
26 obj.link.every((e: any) =>
27 isAtomLink(e) as boolean
28 )) &&
29 (typeof obj.category === "undefined" ||
30 Array.isArray(obj.category) &&
31 obj.category.every((e: any) =>
32 isAtomCategory(e) as boolean
33 )) &&
34 (typeof obj.contributor === "undefined" ||
35 Array.isArray(obj.contributor) &&
36 obj.contributor.every((e: any) =>
37 isAtomContributor(e) as boolean
38 )) &&
39 (typeof obj.generator === "undefined" ||
40 isAtomGenerator(obj.generator) as boolean) &&
41 (typeof obj.icon === "undefined" ||
42 typeof obj.icon === "string") &&
43 (typeof obj.logo === "undefined" ||
44 typeof obj.logo === "string") &&
45 (typeof obj.rights === "undefined" ||
46 isAtomRights(obj.rights) as boolean) &&
47 (typeof obj.subtitle === "undefined" ||
48 typeof obj.subtitle === "string")
49 )
50}
51
52export function isAtomGenerator(obj: any, _argumentName?: string): obj is AtomGenerator {
53 return (
54 (obj !== null &&
55 typeof obj === "object" ||
56 typeof obj === "function") &&
57 typeof obj.value === "string" &&
58 (typeof obj.uri === "undefined" ||
59 typeof obj.uri === "string") &&
60 (typeof obj.version === "undefined" ||
61 typeof obj.version === "string")
62 )
63}
64
65export function isAtomEntry(obj: any, _argumentName?: string): obj is AtomEntry {
66 return (
67 (obj !== null &&
68 typeof obj === "object" ||
69 typeof obj === "function") &&
70 typeof obj.id === "string" &&
71 isAtomTitle(obj.title) as boolean &&
72 obj.updated instanceof Date &&
73 (typeof obj.author === "undefined" ||
74 Array.isArray(obj.author) &&
75 obj.author.every((e: any) =>
76 isAtomAuthor(e) as boolean
77 )) &&
78 (typeof obj.content === "undefined" ||
79 isAtomContent(obj.content) as boolean) &&
80 (typeof obj.link === "undefined" ||
81 Array.isArray(obj.link) &&
82 obj.link.every((e: any) =>
83 isAtomLink(e) as boolean
84 )) &&
85 (typeof obj.summary === "undefined" ||
86 isAtomSummary(obj.summary) as boolean) &&
87 (typeof obj.category === "undefined" ||
88 Array.isArray(obj.category) &&
89 obj.category.every((e: any) =>
90 isAtomCategory(e) as boolean
91 )) &&
92 (typeof obj.contributor === "undefined" ||
93 Array.isArray(obj.contributor) &&
94 obj.contributor.every((e: any) =>
95 isAtomContributor(e) as boolean
96 )) &&
97 (typeof obj.published === "undefined" ||
98 obj.published instanceof Date) &&
99 (typeof obj.rights === "undefined" ||
100 isAtomRights(obj.rights) as boolean) &&
101 (typeof obj.source === "undefined" ||
102 isAtomSource(obj.source) as boolean)
103 )
104}
105
106export function isAtomSource(obj: any, _argumentName?: string): obj is AtomSource {
107 return (
108 (obj !== null &&
109 typeof obj === "object" ||
110 typeof obj === "function") &&
111 typeof obj.id === "string" &&
112 typeof obj.title === "string" &&
113 obj.updated instanceof Date
114 )
115}
116
117export function isAtomCategory(obj: any, _argumentName?: string): obj is AtomCategory {
118 return (
119 (obj !== null &&
120 typeof obj === "object" ||
121 typeof obj === "function") &&
122 typeof obj.term === "string" &&
123 (typeof obj.scheme === "undefined" ||
124 typeof obj.scheme === "string") &&
125 (typeof obj.label === "undefined" ||
126 typeof obj.label === "string")
127 )
128}
129
130export function isAtomContent(obj: any, _argumentName?: string): obj is AtomContent {
131 return (
132 (obj !== null &&
133 typeof obj === "object" ||
134 typeof obj === "function") &&
135 (typeof obj.type === "undefined" ||
136 obj.type === "text" ||
137 obj.type === "html" ||
138 obj.type === "xhtml") &&
139 (typeof obj.src === "undefined" ||
140 typeof obj.src === "string") &&
141 typeof obj.value === "string"
142 )
143}
144
145export function isAtomLink(obj: any, _argumentName?: string): obj is AtomLink {
146 return (
147 (obj !== null &&
148 typeof obj === "object" ||
149 typeof obj === "function") &&
150 typeof obj.href === "string" &&
151 (typeof obj.rel === "undefined" ||
152 obj.rel === "alternate" ||
153 obj.rel === "enclosure" ||
154 obj.rel === "related" ||
155 obj.rel === "self" ||
156 obj.rel === "via") &&
157 (typeof obj.type === "undefined" ||
158 typeof obj.type === "string") &&
159 (typeof obj.hreflang === "undefined" ||
160 typeof obj.hreflang === "string") &&
161 (typeof obj.title === "undefined" ||
162 typeof obj.title === "string") &&
163 (typeof obj.length === "undefined" ||
164 typeof obj.length === "string")
165 )
166}
167
168export function isAtomPerson(obj: any, _argumentName?: string): obj is AtomPerson {
169 return (
170 (obj !== null &&
171 typeof obj === "object" ||
172 typeof obj === "function") &&
173 typeof obj.name === "string" &&
174 (typeof obj.uri === "undefined" ||
175 typeof obj.uri === "string") &&
176 (typeof obj.email === "undefined" ||
177 typeof obj.email === "string")
178 )
179}
180
181export function isAtomLinkRelType(obj: any, _argumentName?: string): obj is AtomLinkRelType {
182 return (
183 (obj === "alternate" ||
184 obj === "enclosure" ||
185 obj === "related" ||
186 obj === "self" ||
187 obj === "via")
188 )
189}
190
191export function isAtomAuthor(obj: any, _argumentName?: string): obj is AtomAuthor {
192 return (
193 isAtomPerson(obj) as boolean
194 )
195}
196
197export function isAtomContributor(obj: any, _argumentName?: string): obj is AtomContributor {
198 return (
199 isAtomPerson(obj) as boolean
200 )
201}
202
203export function isAtomText(obj: any, _argumentName?: string): obj is AtomText {
204 return (
205 (obj !== null &&
206 typeof obj === "object" ||
207 typeof obj === "function") &&
208 (typeof obj.type === "undefined" ||
209 obj.type === "text" ||
210 obj.type === "html" ||
211 obj.type === "xhtml") &&
212 typeof obj.value === "string"
213 )
214}
215
216export function isAtomTextType(obj: any, _argumentName?: string): obj is AtomTextType {
217 return (
218 (obj === "text" ||
219 obj === "html" ||
220 obj === "xhtml")
221 )
222}
223
224export function isAtomTitle(obj: any, _argumentName?: string): obj is AtomTitle {
225 return (
226 isAtomText(obj) as boolean
227 )
228}
229
230export function isAtomSummary(obj: any, _argumentName?: string): obj is AtomSummary {
231 return (
232 isAtomText(obj) as boolean
233 )
234}
235
236export function isAtomRights(obj: any, _argumentName?: string): obj is AtomRights {
237 return (
238 isAtomText(obj) as boolean
239 )
240}