import { stringValue } from 'vega' ; import { ANCHOR } from '../store/factory/Signal' ; import name from './exportName' ; param { Object } mark param { string } mode param { string } key returns { string } export default function ( mark , mode , key ) { const TARGET = `${ ANCHOR }.target` ; let expr = `(${ ANCHOR } && ${ TARGET } && ${ TARGET }.datum && ` ; if ( key ) { expr += `${ TARGET }.datum.mode === ${ stringValue ( mode ) }  && ` + `${ TARGET }.datum.lyra_id === ${ mark . _id } && ` + `test(regexp(${ stringValue ( key ) }, "i"), ${ TARGET }.datum.key)` ; } else { expr += `${ TARGET }.mark && ${ TARGET }.mark.name === ${ stringValue ( name ( mark . name ) ) }` ; } return `${ expr })` ; } ;