import { createFullMatch } from '../const/regs' ; import { numberPattern } from '../const/syntax' ; import { validOpacity } from './valid' ; const alphaReg = createFullMatch ( `(${ numberPattern })(%?)` ) ; export const parseAlpha = ( s ) => { const alpha = alphaReg . exec ( s ) ; if ( alpha ) { return validOpacity ( alpha [ 2 ] , alpha [ 1 ] ) ; } return s ; } ;