import { ReleaseType , diff , prerelease , valid } from "semver" ; /**
 * Filter versions by release type.
 */ export const getReleasesByType = ( versions , type ) : string [ ] => versions . filter ( ( value , index , array ) => diff ( array [ index - 1 ] ?? value , value ) === type ) ; /**
 * Filter out "time" metadata about the package.
 */ export const getSanitisedReleases = ( releases ) : Map < string , string > => new Map ( Array . from ( releases . entries ( ) ) . filter ( ( [ version , _ ] ) => valid ( version ) ) ) ; /**
 * Filter pre-release versions.
 */ export const getStableReleases = ( releases ) : Map < string , string > => new Map ( Array . from ( releases . entries ( ) ) . filter ( ( [ version , _ ] ) => prerelease ( version ) == null ) ) ;