Socket
Socket
Sign inDemoInstall

url-slug

Package Overview
Dependencies
0
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.0.1

jest.config.json

17

dist/index.js

@@ -11,3 +11,3 @@ (function (global, factory) {

function validate(options, extra) {
function validate (options, extra) {
const camelCase = options.camelCase;

@@ -54,3 +54,3 @@

function replace(string, definitions) {
function replace (string, definitions) {
for (let index = 0, length = string.length; index < length; index++) {

@@ -61,5 +61,5 @@ const char = string[index];

if (replacement !== undefined) {
string = string.substr(0, index)
+ replacement
+ string.substr(index + 1);
string = string.substr(0, index) +
replacement +
string.substr(index + 1);

@@ -108,2 +108,3 @@ const addedCharsCount = String(replacement).length - 1;

// eslint-disable-next-line no-misleading-character-class
const COMBINING_CHARS = /[\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF]+/g;

@@ -189,5 +190,5 @@

if ('' === separator) {
if (separator === '') {
fragments = camelCase ? slug.match(REVERT_CAMELCASE_ONLY) : [String(slug)];
} else if ('string' === typeof separator) {
} else if (typeof separator === 'string') {
fragments = slug.split(separator);

@@ -209,3 +210,3 @@ } else {

for (let transformer in transformers) {
for (const transformer in transformers) {
urlSlug[transformer] = transformers[transformer];

@@ -212,0 +213,0 @@ }

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).urlSlug=t()}(this,(function(){"use strict";const e="(?:[a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))";const t=function(e,t){return e.join(t).toLowerCase()};var n=Object.freeze({__proto__:null,LOWERCASE_TRANSFORMER:t,SENTENCECASE_TRANSFORMER:function(e,t){const n=e.join(t);return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()},TITLECASE_TRANSFORMER:function(e,t){const n=[];for(let t=0;t<e.length;t++)n.push(e[t].charAt(0).toUpperCase()+e[t].slice(1).toLowerCase());return n.join(t)},UPPERCASE_TRANSFORMER:function(e,t){return e.join(t).toUpperCase()}});const o=/[\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF]+/g,r=/[A-Za-z\d]+/g,i=new RegExp("[A-Za-z\\d]*?"+e+"|[A-Za-z\\d]+","g");function s(e,n){const s=void 0===(n=n||{}).camelCase||n.camelCase,a=void 0!==n.separator?n.separator:"-",c=void 0!==n.transformer?n.transformer:t,u=(n.dictionary?function(e,t){for(let n=0,o=e.length;n<o;n++){const r=t[e[n]];if(void 0!==r){e=e.substr(0,n)+r+e.substr(n+1);const t=String(r).length-1;n+=t,o+=t}}return e}(String(e),n.dictionary):String(e)).normalize("NFKD").replace(o,"").match(s?i:r);return u?c?c(u,a):u.join(a):""}const a=/[^-._~!$&'()*+,;=]+/g,c=new RegExp("[^-._~!$&'()*+,;=]*?"+e+"|[^-._~!$&'()*+,;=]+","g"),u=new RegExp(".*?"+e+"|.+","g");const f=function(e,t){return s(e,t)};for(let e in n)f[e]=n[e];return f.convert=s,f.revert=function(e,t){const n=void 0!==(t=t||{}).camelCase&&t.camelCase,o=t.separator,r=void 0!==t.transformer&&t.transformer;let i;return e=String(e),i=""===o?n?e.match(u):[String(e)]:"string"==typeof o?e.split(o):e.match(n?c:a),i?r?r(i," "):i.join(" "):""},f}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).urlSlug=t()}(this,(function(){"use strict";const e="(?:[a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))";const t=function(e,t){return e.join(t).toLowerCase()};var n=Object.freeze({__proto__:null,LOWERCASE_TRANSFORMER:t,SENTENCECASE_TRANSFORMER:function(e,t){const n=e.join(t);return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()},TITLECASE_TRANSFORMER:function(e,t){const n=[];for(let t=0;t<e.length;t++)n.push(e[t].charAt(0).toUpperCase()+e[t].slice(1).toLowerCase());return n.join(t)},UPPERCASE_TRANSFORMER:function(e,t){return e.join(t).toUpperCase()}});const o=/[\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF]+/g,r=/[A-Za-z\d]+/g,i=new RegExp("[A-Za-z\\d]*?"+e+"|[A-Za-z\\d]+","g");function s(e,n){const s=void 0===(n=n||{}).camelCase||n.camelCase,a=void 0!==n.separator?n.separator:"-",c=void 0!==n.transformer?n.transformer:t,u=(n.dictionary?function(e,t){for(let n=0,o=e.length;n<o;n++){const r=t[e[n]];if(void 0!==r){e=e.substr(0,n)+r+e.substr(n+1);const t=String(r).length-1;n+=t,o+=t}}return e}(String(e),n.dictionary):String(e)).normalize("NFKD").replace(o,"").match(s?i:r);return u?c?c(u,a):u.join(a):""}const a=/[^-._~!$&'()*+,;=]+/g,c=new RegExp("[^-._~!$&'()*+,;=]*?"+e+"|[^-._~!$&'()*+,;=]+","g"),u=new RegExp(".*?"+e+"|.+","g");const f=function(e,t){return s(e,t)};for(const e in n)f[e]=n[e];return f.convert=s,f.revert=function(e,t){const n=void 0!==(t=t||{}).camelCase&&t.camelCase,o=t.separator,r=void 0!==t.transformer&&t.transformer;let i;return e=String(e),i=""===o?n?e.match(u):[String(e)]:"string"==typeof o?e.split(o):e.match(n?c:a),i?r?r(i," "):i.join(" "):""},f}));

@@ -29,3 +29,3 @@ const LOWERCASE_TRANSFORMER = function (fragments, separator) {

function validate(options, extra) {
function validate (options, extra) {
const camelCase = options.camelCase;

@@ -72,3 +72,3 @@

function replace(string, definitions) {
function replace (string, definitions) {
for (let index = 0, length = string.length; index < length; index++) {

@@ -79,5 +79,5 @@ const char = string[index];

if (replacement !== undefined) {
string = string.substr(0, index)
+ replacement
+ string.substr(index + 1);
string = string.substr(0, index) +
replacement +
string.substr(index + 1);

@@ -94,2 +94,3 @@ const addedCharsCount = String(replacement).length - 1;

// eslint-disable-next-line no-misleading-character-class
const COMBINING_CHARS = /[\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF]+/g;

@@ -175,5 +176,5 @@

if ('' === separator) {
if (separator === '') {
fragments = camelCase ? slug.match(REVERT_CAMELCASE_ONLY) : [String(slug)];
} else if ('string' === typeof separator) {
} else if (typeof separator === 'string') {
fragments = slug.split(separator);

@@ -180,0 +181,0 @@ } else {

{
"name": "url-slug",
"version": "3.0.0",
"version": "3.0.1",
"description": "Lightweight slug generator, RFC 3986 compliant",
"main": "dist/index.js",
"module": "lib/index.js",
"type": "module",
"types": "lib/index.d.ts",

@@ -14,3 +13,3 @@ "scripts": {

"postversion": "git push && git push --tags",
"test": "node --experimental-vm-modules node_modules/.bin/jest"
"test": "standard --env jest && jest"
},

@@ -21,4 +20,6 @@ "devDependencies": {

"jest": "^26.6.3",
"rollup": "^2.35.1",
"rollup-plugin-terser": "^7.0.2"
"jest-esm-transformer": "^1.0.0",
"rollup": "^2.36.0",
"rollup-plugin-terser": "^7.0.2",
"standard": "*"
},

@@ -25,0 +26,0 @@ "repository": "https://github.com/stldo/url-slug",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc