import { BufferSet } from '../data_structures/buffer_set' ; export const bufferArrayIncludes = ( arr , val ) : boolean => arr . find ( a => a . equals ( val ) ) !== undefined ; export const bufferArrayContains = ( arr1 , arr2 ) : boolean => arr2 . every ( val => bufferArrayIncludes ( arr1 , val ) ) ; export const bufferArrayContainsSome = ( arr1 , arr2 ) : boolean => arr2 . some ( val => bufferArrayIncludes ( arr1 , val ) ) ; export const bufferArrayEqual = ( arr1 , arr2 ) : boolean => arr1 . length === arr2 . length && arr1 . every ( ( val , index ) => val . equals ( arr2 [ index ] ) ) ; export const bufferArraySubtract = ( arr1 , arr2 ) : Buffer [ ] => arr1 . filter ( a => ! bufferArrayIncludes ( arr2 , a ) ) ; export const bufferArrayOrderByLex = ( arr1 ) : boolean => { const sortedArray = [ ... arr1 ] ; sortedArray . sort ( ( a , b ) => a . compare ( b ) ) ; return bufferArrayEqual ( arr1 , sortedArray ) ; } ; export const bufferArrayUniqueItems = ( arr1 ) : boolean => arr1 . length === new BufferSet ( [ ... arr1 ] ) . size ;