UNPKG

flow-immutable-models

Version:

Generates model classes from Flow types using Immutable.js

19 lines (15 loc) 420 B
// @flow const modelTypeLength = 'ModelType'.length; export function endsWithModelType(str: ?string): boolean { return ( !!str && str.length > modelTypeLength && str.indexOf('ModelType') === str.length - modelTypeLength ); } export function withoutModelTypeSuffix(str: string): string { if (endsWithModelType(str)) { return str.substring(0, str.length - 'ModelType'.length); } return str; }