(author, prefix, errors, required)
| 157 | } |
| 158 | |
| 159 | function validateAuthor(author, prefix, errors, required) { |
| 160 | if (author === undefined) { |
| 161 | if (required) { |
| 162 | errors.push(`${prefix}: "author" is required`); |
| 163 | } |
| 164 | return; |
| 165 | } |
| 166 | |
| 167 | if (!author || typeof author !== "object" || Array.isArray(author)) { |
| 168 | errors.push(`${prefix}: "author" must be an object`); |
| 169 | return; |
| 170 | } |
| 171 | |
| 172 | if (!isNonEmptyString(author.name)) { |
| 173 | errors.push(`${prefix}: "author.name" is required and must be a non-empty string`); |
| 174 | } |
| 175 | |
| 176 | if (author.url !== undefined) { |
| 177 | validateHttpsUrl(author.url, "author.url", prefix, errors); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | function validateLicense(license, prefix, errors, required) { |
| 182 | if (license === undefined) { |
no test coverage detected