coveo-search-ui
Version:
Coveo JavaScript Search Framework
21 lines (18 loc) • 472 B
text/typescript
import { KeywordsInput } from './KeywordsInput';
import { l } from '../../../strings/Strings';
export class NoneKeywordsInput extends KeywordsInput {
constructor(public root: HTMLElement) {
super(l('NoneOfTheseWords'), root);
}
public getValue() {
const value = super.getValue();
if (!value) {
return '';
}
return value
.replace(/\s+/g, ' ')
.split(' ')
.map(keyword => `NOT "<@-${keyword}-@>"`)
.join(' ');
}
}