(schema)
| 39 | fn: 'isIso4217CurrencyCode', |
| 40 | error: {message: 'must be a valid ISO 4217 currency code'}, |
| 41 | shouldUse(schema) { |
| 42 | if (!iso4217DescriptionRe.test(schema.description)) { |
| 43 | return false; |
| 44 | } |
| 45 | if ( |
| 46 | !Array.isArray(schema.enum) || |
| 47 | JSON.stringify(schema.enum.sort()) !== JSON.stringify(iso4217.sort()) |
| 48 | ) { |
| 49 | throw new Error( |
| 50 | 'ISO 4217 schema must contain an `enum` keyword including all valid currency codes.' |
| 51 | ); |
| 52 | } |
| 53 | delete schema.enum; |
| 54 | return true; |
| 55 | }, |
| 56 | }, |
| 57 | ]; |
| 58 |
no test coverage detected