Skip to content

How to use the validate function with find? Doesn't seem to be working! #450

@rfgamaral

Description

@rfgamaral

Hi there,

I'm trying to use the validate function with find, but it doesn't seem to be working:

import { find } from 'linkifyjs'

const content = `[GitHub](https://github.com)

[Linkify](https://linkify.js.org "Linkify: a JS plugin by Hypercontext")`

const testA1 = find(content, {
  validate: false
})

const testA2 = find(content, {
  validate: () => false
})

const testA3 = find(content, {
  validate: {
    url: () => false
  }
})

const testB1 = find(content, 'url', {
  validate: false
})

const testB2 = find(content, 'url', {
  validate: () => false
})

const testB3 = find(content, 'url', {
  validate: {
    url: () => false
  }
})

console.log(testA1, testA2, testA3)
console.log(testB1, testB2, testB3)

Output:

image

CodeSandbox:

Am I using it wrong, or is there an issue somewhere?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions