import Entity from "../entity/entity" ; import Search from "./search" ; import WhereField from "./where-field" ; export default class WhereArray < TEntity extends Entity > extends WhereField < TEntity > { private value ! : string [ ] ; contain ( value ) { this . value = [ value ] ; return this . search ; } contains ( value ) { return this . contain ( value ) ; } containsOneOf ( ... value ) { this . value = value ; return this . search ; } containOneOf ( ... value ) { return this . containsOneOf ( ... value ) ; } toString ( ) { let matchPunctuation = /[,.<>{}[\]"':;!@#$%^&*()\-+=~| ]/g ; let escapedValue = this . value . map ( s => s . replace ( matchPunctuation , '\\$&' ) ) . join ( '|' ) ; return this . buildQuery ( `{${ escapedValue }}` ) ; } }