Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
url-safe-string
Advanced tools
Dependency free node module to convert strings to URL-safe tags for client side routing, SEO purposes, or, whatever else.
Dependency free node module to convert strings to URL-safe tags for client side routing, SEO purposes, or, whatever else.
This module has no dependencies, is written in vanilla JavaScript and the newest features it uses are in ES5 (String.prototype.trim(), which happens to be optional). It should work in just about any browser, has a small footprint and is meant to be used with frameworks such as AngularJS. The module is also fully tested.
This module uses new ECMAScript 2015 (aka ES6) Syntax "const" and "let". Please use it with node 4 or above or transpile it before using it in a browser. If you want to write a babel post-install npm script I'll accept the PR :)
You can also ref the 1.0.0 version if you need the older syntax for the browser.
npm install --save url-safe-string
const UrlSafeString = require('url-safe-string'),
tagGenerator = new UrlSafeString();
let tag = tagGenerator.generate('Some Book Name Here!', 'Some authors Name', 'Publisher or something...');
// tag value --> 'some-book-name-here-some-authors-name-publisher-or-something'
These are the default options, which can all be overriden by passing an object into the constructor.
// Configured Defaults:
const _opts = {
maxLen: 100, // truncates beyond maxLen
lowercaseOnly: true,
regexRemovePattern: /((?!([a-z0-9])).)/gi, // matches opposite of [a-z0-9]
joinString: '-', // e.g. - may be: '-', '_', '#'
trimWhitespace: true
}
// Call constructor with custom options:
const urlSafeTag = new UrlSafeTag({
maxLen: 50,
lowercaseOnly: false
});
This module has a test suite, it uses mocha which is installed via dev dependencies. You can run it using npm scripts:
npm run test
FAQs
Dependency free node module to convert strings to URL-safe tags for client side routing, SEO purposes, or, whatever else.
We found that url-safe-string demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.