UNPKG

wowok

Version:

Wowok Blockchain TypeScript API

1 lines 661 B
const ORG_NAME_REGEX=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,NAME_PATTERN=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,VERSION_REGEX=/^\d+$/,MAX_APP_SIZE=0x40,NAME_SEPARATOR='/';export const isValidNamedPackage=a=>{const b=a['split'](NAME_SEPARATOR);if(b['length']<0x2||b['length']>0x3)return![];const [c,d,e]=b;if(e!==undefined&&!VERSION_REGEX['test'](e))return![];if(!ORG_NAME_REGEX['test'](c))return![];return NAME_PATTERN['test'](d)&&d['length']<MAX_APP_SIZE;};export const isValidNamedType=a=>{const b=a['split'](/::|<|>|,/);for(const c of b){if(c['includes'](NAME_SEPARATOR)&&!isValidNamedPackage(c))return![];}return!![];};