UNPKG

flow-immutable-models

Version:

Generates model classes from Flow types using Immutable.js

22 lines (19 loc) 640 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.isArray = isArray; exports.isObjectMap = isObjectMap; exports.isImmutableType = isImmutableType; function isArray(typeAlias) { return typeAlias.type === 'ArrayTypeAnnotation' || typeAlias.id && typeAlias.id.name === 'Array'; } function isObjectMap(typeAlias) { return typeAlias.type === 'ObjectTypeAnnotation' && typeAlias.indexers.length > 0; } function isImmutableType(typeAlias) { if (typeAlias.id && typeAlias.id.type === 'QualifiedTypeIdentifier' && typeAlias.id.qualification.name === 'Immutable') { return true; } return false; }