Comparing version 3.3.2 to 3.3.3
{ | ||
"name": "slug", | ||
"description": "slugifies even utf-8 chars!", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"homepage": "https://github.com/Trott/slug", | ||
@@ -23,2 +23,3 @@ "author": "dodo (https://github.com/dodo)", | ||
"test": "standard && nyc --reporter none mocha test/**/*.js && karma start --single-run --browsers ChromeHeadless,FirefoxHeadless .karma.config.js && nyc report --reporter=text --reporter=html && nyc check-coverage --lines 100 --branches 100 --statements 100 --functions 100", | ||
"test-ci": "./node_modules/.bin/karma start .karma.config-ci.js", | ||
"benchmark": "node benchmark/benchmark.js" | ||
@@ -32,5 +33,7 @@ }, | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-coverage": "^2.0.2", | ||
"karma-coverage": "^2.0.3", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-jasmine": "^3.3.1", | ||
"karma-mocha": "^2.0.1", | ||
"karma-sauce-launcher": "^4.1.5", | ||
"mocha": "^8.0.1", | ||
@@ -37,0 +40,0 @@ "nyc": "^15.0.1", |
@@ -95,1 +95,3 @@ # [slug](https://github.com/Trott/slug) | ||
``` | ||
[![Testing Powered By SauceLabs](https://opensource.saucelabs.com/images/opensauce/powered-by-saucelabs-badge-gray.png?sanitize=true "Testing Powered By SauceLabs")](https://saucelabs.com) |
43
slug.js
@@ -15,3 +15,3 @@ /* global btoa */ | ||
/* istanbul ignore if */ | ||
if (Number.isNaN(code)) { | ||
if (isNaN(code)) { | ||
throw new RangeError('Index ' + i + ' out of range for string "' + str + '"; please open an issue at https://github.com/Trott/slug/issues/new') | ||
@@ -65,2 +65,34 @@ } | ||
// IE11 doesn't have Object.assign(), hence this MDN-supplied polyfill. | ||
/* istanbul ignore if */ | ||
if (typeof Object.assign !== 'function') { | ||
// Must be writable: true, enumerable: false, configurable: true | ||
Object.defineProperty(Object, 'assign', { | ||
value: function assign (target, varArgs) { // .length of function is 2 | ||
'use strict' | ||
if (target === null || target === undefined) { | ||
throw new TypeError('Cannot convert undefined or null to object') | ||
} | ||
var to = Object(target) | ||
for (var index = 1; index < arguments.length; index++) { | ||
var nextSource = arguments[index] | ||
if (nextSource !== null && nextSource !== undefined) { | ||
for (var nextKey in nextSource) { | ||
// Avoid bugs when hasOwnProperty is shadowed | ||
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { | ||
to[nextKey] = nextSource[nextKey] | ||
} | ||
} | ||
} | ||
} | ||
return to | ||
}, | ||
writable: true, | ||
configurable: true | ||
}) | ||
} | ||
function slug (string, opts) { | ||
@@ -72,5 +104,6 @@ var result = slugify(string, opts) | ||
let input = '' | ||
for (let i = 0, chr; i < string.length; i++) { | ||
[chr, i] = getWholeCharAndI(string, i) | ||
input += chr | ||
for (let i = 0; i < string.length; i++) { | ||
const charAndI = getWholeCharAndI(string, i) | ||
i = charAndI[1] | ||
input += charAndI[0] | ||
} | ||
@@ -197,2 +230,3 @@ result = slugify(base64(input), opts) | ||
Ø: 'O', | ||
Ō: 'O', | ||
Ù: 'U', | ||
@@ -231,2 +265,3 @@ Ú: 'U', | ||
ø: 'o', | ||
ō: 'o', | ||
ù: 'u', | ||
@@ -233,0 +268,0 @@ ú: 'u', |
Sorry, the diff of this file is not supported yet
28322
7
888
97
13