UNPKG

@nodescript/stdlib

Version:
25 lines (24 loc) 642 B
export const module = { version: '1.2.4', moduleName: 'Logic / Contains', description: 'Checks if "needle" occurs anywhere inside "haystack".', keywords: ['includes'], params: { haystack: { schema: { type: 'any' }, }, needle: { schema: { type: 'any' }, }, strict: { schema: { type: 'boolean', default: false, }, }, }, result: { schema: { type: 'boolean' }, } }; export const compute = (params, ctx) => { const { haystack, needle, strict } = params; return ctx.lib.anyContains(haystack, needle, { strict }); };