/**
 * The following IP/CIDR functions are from a blog post
 *
 * [MyBuilder.com] https param { string } ip returns { number } const ip4ToInt = ( ip ) => ip . split ( "." ) . reduce ( ( int , oct ) => ( int << 8 ) + parseInt ( oct , 10 ) , 0 ) >>> 0 ; param { string } ip returns { Function } const isIp4InCidr = ( ip ) => ( cidr ) => { const [ range , bits = 32 ] = cidr . split ( "/" ) ; const mask = ~ ( 2 ** ( 32 - bits ) - 1 ) ; return ( ip4ToInt ( ip ) & mask ) === ( ip4ToInt ( range ) & mask ) ; } ; param { string } ip param { string [ ] } cidrs returns { boolean } example export const isIp4InCidrs = ( ip , cidrs ) : boolean => cidrs . some ( isIp4InCidr ( ip ) ) ;