asian-regexps
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -0,0 +0,0 @@ export declare const chineseRegExp: RegExp; |
@@ -1,8 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.chineseRegExp = /([\u4E00-\u9FCC\u3400-\u4DB5\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\ud840-\ud868][\udc00-\udfff]|\ud869[\udc00-\uded6\udf00-\udfff]|[\ud86a-\ud86c][\udc00-\udfff]|\ud86d[\udc00-\udf34\udf40-\udfff]|\ud86e[\udc00-\udc1d])+/; | ||
exports.koreanRegExp = /([\uac00-\ud7af]|[\u1100-\u11ff]|[\u3130-\u318f]|[\ua960-\ua97f]|[\ud7b0-\ud7ff])+/; | ||
exports.japaneseRegExp = /([\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf])+/; | ||
exports.isKorean = function (input) { return !!input.match(exports.koreanRegExp); }; | ||
exports.isChinese = function (input) { return !!input.match(exports.chineseRegExp); }; | ||
exports.isJapanese = function (input) { return !!input.match(exports.japaneseRegExp); }; | ||
export const chineseRegExp = /([\u4E00-\u9FCC\u3400-\u4DB5\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\ud840-\ud868][\udc00-\udfff]|\ud869[\udc00-\uded6\udf00-\udfff]|[\ud86a-\ud86c][\udc00-\udfff]|\ud86d[\udc00-\udf34\udf40-\udfff]|\ud86e[\udc00-\udc1d])+/; | ||
export const koreanRegExp = /([\uac00-\ud7af]|[\u1100-\u11ff]|[\u3130-\u318f]|[\ua960-\ua97f]|[\ud7b0-\ud7ff])+/; | ||
export const japaneseRegExp = /([\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf])+/; | ||
export const isKorean = (input) => !!input.match(koreanRegExp); | ||
export const isChinese = (input) => !!input.match(chineseRegExp); | ||
export const isJapanese = (input) => !!input.match(japaneseRegExp); |
{ | ||
"name": "asian-regexps", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Chinese, Japanese, Korean convenient RegExp ESM Node.js module", | ||
"keywords": ["regexp", "chinese", "korean", "japanese", "asia"], | ||
"main": "asian-regexps.js", | ||
"module": "asian-regexps.js", | ||
"types": "asian-regexps.d.ts", | ||
"scripts": { | ||
"build": "tsc" | ||
"build": "tsc & cp asian-regexps.js asian-regexps.mjs" | ||
} | ||
} |
# asian-regexps | ||
Chinese, Japanese, Korean convenient RegExp package | ||
Chinese, Japanese, Korean convenient RegExp ESModule | ||
@@ -11,11 +11,25 @@ ## installation | ||
### javascript | ||
### typescript | ||
```typescript | ||
import { isKorean } from 'asian-regexps' | ||
isKorean('한글') // true | ||
``` | ||
### browser | ||
```html | ||
<script type="module"> | ||
import { isKorean } from './node_modules/asian-regexps/asian-regexps.js' | ||
isKorean('한글') // true | ||
</script> | ||
``` | ||
### CommonJS (legacy) | ||
```javascript | ||
const { isKorean } = require('asian-regexps') | ||
const { isKorean } = require('asian-regexps/legacy') | ||
isKorean('한글') // true | ||
``` | ||
### typescript | ||
### ESModule | ||
```javascript | ||
import { isKorean } from 'asian-regexps' | ||
import { isKorean } from 'asian-regexps/asian-regexps.mjs' | ||
isKorean('한글') // true | ||
@@ -22,0 +36,0 @@ ``` |
@@ -5,6 +5,6 @@ { | ||
// "incremental": true, /* Enable incremental compilation */ | ||
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ | ||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ | ||
"target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ | ||
"module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ | ||
// "lib": [], /* Specify library files to be included in the compilation. */ | ||
// "allowJs": true, /* Allow javascript files to be compiled. */ | ||
// "allowJs": true, /* Allow javascript files to be compiled. */ | ||
// "checkJs": true, /* Report errors in .js files. */ | ||
@@ -11,0 +11,0 @@ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ |
10130
9
93
49