@sindresorhus/transliterate
Advanced tools
Comparing version 0.1.2 to 1.0.0
@@ -1,26 +0,24 @@ | ||
declare namespace transliterate { | ||
interface Options { | ||
/** | ||
Add your own custom replacements. | ||
export interface Options { | ||
/** | ||
Add your own custom replacements. | ||
The replacements are run on the original string before any other transformations. | ||
The replacements are run on the original string before any other transformations. | ||
This only overrides a default replacement if you set an item with the same key. | ||
This only overrides a default replacement if you set an item with the same key. | ||
@default [] | ||
@default [] | ||
@example | ||
``` | ||
import transliterate = require('@sindresorhus/transliterate'); | ||
@example | ||
``` | ||
import transliterate from '@sindresorhus/transliterate'; | ||
transliterate('Я люблю единорогов', { | ||
customReplacements: [ | ||
['единорогов', '🦄'] | ||
] | ||
}) | ||
//=> 'Ya lyublyu 🦄' | ||
``` | ||
*/ | ||
readonly customReplacements?: ReadonlyArray<[string, string]>; | ||
} | ||
transliterate('Я люблю единорогов', { | ||
customReplacements: [ | ||
['единорогов', '🦄'] | ||
] | ||
}) | ||
//=> 'Ya lyublyu 🦄' | ||
``` | ||
*/ | ||
readonly customReplacements?: ReadonlyArray<[string, string]>; | ||
} | ||
@@ -35,3 +33,3 @@ | ||
``` | ||
import transliterate = require('@sindresorhus/transliterate'); | ||
import transliterate from '@sindresorhus/transliterate'; | ||
@@ -51,7 +49,2 @@ transliterate('Fußgängerübergänge'); | ||
*/ | ||
declare function transliterate( | ||
string: string, | ||
options?: transliterate.Options | ||
): string; | ||
export = transliterate; | ||
export default function transliterate(string: string, options?: Options): string; |
11
index.js
@@ -1,5 +0,4 @@ | ||
'use strict'; | ||
const deburr = require('lodash.deburr'); | ||
const escapeStringRegexp = require('escape-string-regexp'); | ||
const builtinReplacements = require('./replacements'); | ||
import deburr from 'lodash.deburr'; | ||
import escapeStringRegexp from 'escape-string-regexp'; | ||
import builtinReplacements from './replacements.js'; | ||
@@ -15,3 +14,3 @@ const doCustomReplacements = (string, replacements) => { | ||
module.exports = (string, options) => { | ||
export default function transliterate(string, options) { | ||
if (typeof string !== 'string') { | ||
@@ -36,2 +35,2 @@ throw new TypeError(`Expected a string, got \`${typeof string}\``); | ||
return string; | ||
}; | ||
} |
{ | ||
"name": "@sindresorhus/transliterate", | ||
"version": "0.1.2", | ||
"version": "1.0.0", | ||
"description": "Convert Unicode characters to Latin characters using transliteration", | ||
@@ -13,4 +13,6 @@ "license": "MIT", | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=12" | ||
}, | ||
@@ -39,10 +41,10 @@ "scripts": { | ||
"dependencies": { | ||
"escape-string-regexp": "^2.0.0", | ||
"escape-string-regexp": "^5.0.0", | ||
"lodash.deburr": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.4.0", | ||
"tsd": "^0.11.0", | ||
"xo": "^0.26.1" | ||
"ava": "^3.15.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.38.2" | ||
} | ||
} |
@@ -16,3 +16,3 @@ # transliterate | ||
```js | ||
const transliterate = require('@sindresorhus/transliterate'); | ||
import transliterate from '@sindresorhus/transliterate'; | ||
@@ -58,3 +58,3 @@ transliterate('Fußgängerübergänge'); | ||
```js | ||
const transliterate = require('@sindresorhus/transliterate'); | ||
import transliterate from '@sindresorhus/transliterate'; | ||
@@ -61,0 +61,0 @@ transliterate('Я люблю единорогов', { |
@@ -1,4 +0,2 @@ | ||
'use strict'; | ||
module.exports = [ | ||
const replacements = [ | ||
// German umlauts | ||
@@ -798,1 +796,3 @@ ['ß', 'ss'], | ||
]; | ||
export default replacements; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
Yes
17300
835
+ Addedescape-string-regexp@5.0.0(transitive)
- Removedescape-string-regexp@2.0.0(transitive)
Updatedescape-string-regexp@^5.0.0