Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

zelda-js

Package Overview
Dependencies
Maintainers
12
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zelda-js

Link collector and decorator for text content

latest
Source
npmnpm
Version
3.3.1
Version published
Maintainers
12
Created
Source

Zelda

Installation

npm install zelda-js --save

Usage

const targets = require('zelda-js').targets;
const Zelda = require('zelda-js').Zelda;

const zelda = new Zelda({
  tokens: ['$token 1$']
});

let linkifiedText = zelda.linkify('... text source ...', targets.BLANK);
let urls = zelda.collectLinks('... text source ...');

zelda.setTokens(['$token 2$']);

Options

  • tokens : Array - list of tokens which urls contain

Methods

linkify(text: String, target: String)

  • Convert urls in plain text to HTML <a> tags
  • Handle non-standard urls (with tokens)

collectLinks(text: String)

  • Collect urls and their offsets from plain text
  • Handle non-standard urls (with tokens)
  • Return with the numbers where url found (offsets)

FAQs

Package last updated on 21 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts