react-slugify
Advanced tools
Comparing version 1.0.2 to 1.1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var harmonize = function (text) { return text | ||
exports.__esModule = true; | ||
var stripAccents = function (str) { | ||
var accents = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž'; | ||
var fixes = 'AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz'; | ||
var split = accents.split('').join('|'); | ||
var reg = new RegExp("(" + split + ")", 'g'); | ||
function replacement(a) { | ||
return fixes[accents.indexOf(a)] || ''; | ||
} | ||
return str.replace(reg, replacement).toLowerCase(); | ||
}; | ||
var harmonize = function (text) { return stripAccents(text) | ||
.toLowerCase() | ||
@@ -37,3 +47,3 @@ .replace(/\s+/g, '-') | ||
}; | ||
exports.default = slugify; | ||
exports["default"] = slugify; | ||
//# sourceMappingURL=slugify.js.map |
{ | ||
"name": "react-slugify", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Slugify a React node", | ||
@@ -5,0 +5,0 @@ "main": "dist/slugify.js", |
import * as React from 'react'; | ||
const harmonize = (text: string) => text | ||
const stripAccents = (str: string): string => { | ||
const accents = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž'; | ||
const fixes = 'AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz'; | ||
const split = accents.split('').join('|'); | ||
const reg = new RegExp(`(${split})`, 'g'); | ||
function replacement(a: string) { | ||
return fixes[accents.indexOf(a)] || ''; | ||
} | ||
return str.replace(reg, replacement).toLowerCase(); | ||
}; | ||
const harmonize = (text: string): string => stripAccents(text) | ||
.toLowerCase() | ||
@@ -5,0 +18,0 @@ .replace(/\s+/g, '-') |
{ | ||
"compileOnSave": false, | ||
"compilerOptions": { | ||
"target": "es5", | ||
"target": "es3", | ||
"module": "commonjs", | ||
@@ -15,8 +15,12 @@ "jsx": "preserve", | ||
"outDir": "dist", | ||
"declaration": true | ||
"declaration": true, | ||
"lib": [ | ||
"es2017" | ||
] | ||
}, | ||
"exclude": [ | ||
"**/node_modules", | ||
"**/__tests__/**" | ||
"**/__tests__/**", | ||
"dist/**" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
9334
174