Skip to content

Commit 8dada2c

Browse files
committed
.
1 parent ccb6130 commit 8dada2c

File tree

5 files changed

+93
-43
lines changed

5 files changed

+93
-43
lines changed

packages/@lazy-cjk/fullhalf/dist/index.cjs.development.cjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,20 @@ function _filterTable(data) {
155155
}
156156
return _a;
157157
}
158+
var index = {
159+
toFullNumber,
160+
toHalfNumber,
161+
toFullEnglish,
162+
toHalfEnglish,
163+
toFullWidth,
164+
toHalfWidth
165+
};
158166

159167
exports._chkType = _chkType;
160168
exports._filterTable = _filterTable;
161169
exports._optionsType = _optionsType;
162170
exports.chkType = chkType;
171+
exports.default = index;
163172
exports.factory = factory;
164173
exports.process = process;
165174
exports.toFullEnglish = toFullEnglish;

packages/@lazy-cjk/fullhalf/dist/index.cjs.production.min.cjs

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,39 @@ Object.defineProperty(exports, "__esModule", {
44
value: !0
55
});
66

7-
var e = require("@lazy-cjk/fullhalf-char-code"), t = require("uni-string"), o = require("deepmerge"), r = require("@lazy-cjk/fullhalf-data");
7+
var e = require("@lazy-cjk/fullhalf-char-code"), t = require("uni-string"), o = require("deepmerge"), l = require("@lazy-cjk/fullhalf-data");
88

9-
let l = {
9+
let r = {
1010
only: {
1111
number: !0
1212
}
1313
};
1414

15-
const n = factory(e.toFullWidthCharCode, 1, l), f = factory(e.toHalfWidthCharCode, 0, l);
15+
const n = factory(e.toFullWidthCharCode, 1, r), f = factory(e.toHalfWidthCharCode, 0, r);
1616

17-
l = {
17+
r = {
1818
only: {
1919
eng: !0
2020
}
2121
};
2222

23-
const a = factory(e.toFullWidthCharCode, 1, l), i = factory(e.toHalfWidthCharCode, 0, l);
23+
const a = factory(e.toFullWidthCharCode, 1, r), i = factory(e.toHalfWidthCharCode, 0, r);
2424

25-
l = {
25+
r = {
2626
only: {
2727
default: !0
2828
}
2929
};
3030

31-
const p = factory(e.toFullWidthCharCode, 1, l), u = factory(e.toHalfWidthCharCode, 0, l);
31+
const u = factory(e.toFullWidthCharCode, 1, r), p = factory(e.toHalfWidthCharCode, 0, r);
3232

3333
function _optionsType(e) {
3434
if (e) if ("boolean" == typeof e.exists) {
35-
for (let t in r.tableFullHalf[0]) 0 != t.indexOf("default") && !1 !== e[t] && (e[t] = e.exists);
35+
for (let t in l.tableFullHalf[0]) 0 != t.indexOf("default") && !1 !== e[t] && (e[t] = e.exists);
3636
delete e.exists;
3737
} else {
3838
if ("boolean" == typeof e.default) {
39-
for (let t of r.tableFullHalfDefaultInclude) !1 !== e[t] && (e[t] = e.default);
39+
for (let t of l.tableFullHalfDefaultInclude) !1 !== e[t] && (e[t] = e.default);
4040
delete e.default;
4141
}
4242
"boolean" == typeof e.not_default2 && (e.both = e.space = e.not_default2, delete e.not_default2),
@@ -52,47 +52,57 @@ function _chkType(e, t) {
5252
}
5353

5454
function chkType(e, t, o) {
55-
let l = r.tableFullHalf[o][t];
56-
if (Array.isArray(l.not) && l.not.length) for (let t of l.not) if (_chkType(e, t)) return !1;
57-
if (_chkType(e, l)) return !0;
55+
let r = l.tableFullHalf[o][t];
56+
if (Array.isArray(r.not) && r.not.length) for (let t of r.not) if (_chkType(e, t)) return !1;
57+
if (_chkType(e, r)) return !0;
5858
}
5959

60-
function process(e, o, r) {
61-
let l = [];
62-
r.skip = _optionsType(r.skip), r.only = _optionsType(r.only);
60+
function process(e, o, l) {
61+
let r = [];
62+
l.skip = _optionsType(l.skip), l.only = _optionsType(l.only);
6363
let n = Array.isArray(e) ? e : new t(e);
6464
for (let e of n) {
6565
let t, n = "number" == typeof e ? e : e.codePointAt();
66-
if (r.only) {
66+
if (l.only) {
6767
t = !0;
68-
for (let e in r.only) if (r.only[e] && chkType(n, e, r.type)) {
68+
for (let e in l.only) if (l.only[e] && chkType(n, e, l.type)) {
6969
t = !1;
7070
break;
7171
}
7272
}
73-
if (!t && r.skip) for (let e in r.skip) if (r.skip[e] && chkType(n, e, r.type)) {
73+
if (!t && l.skip) for (let e in l.skip) if (l.skip[e] && chkType(n, e, l.type)) {
7474
t = !0;
7575
break;
7676
}
77-
l.push(t ? n : o(n));
77+
r.push(t ? n : o(n));
7878
}
79-
return r.returnType ? l : String.fromCodePoint.apply(String, l);
79+
return l.returnType ? r : String.fromCodePoint.apply(String, r);
8080
}
8181

82-
function factory(e, t, r) {
83-
return (l, n) => (n = o.all([ {}, n || {}, r || {}, {
82+
function factory(e, t, l) {
83+
return (r, n) => (n = o.all([ {}, n || {}, l || {}, {
8484
type: t
85-
} ]), process(l, e, n));
85+
} ]), process(r, e, n));
8686
}
8787

88+
var s = {
89+
toFullNumber: n,
90+
toHalfNumber: f,
91+
toFullEnglish: a,
92+
toHalfEnglish: i,
93+
toFullWidth: u,
94+
toHalfWidth: p
95+
};
96+
8897
exports._chkType = _chkType, exports._filterTable = function _filterTable(e) {
8998
let t = [];
9099
if (e.from && e.to) for (let o = e.from; o <= e.to; o++) t.push(o);
91100
return e.values && (t = t.concat(e.values)), Array.isArray(e.not) && e.not.length && (t = t.filter((function(t) {
92101
for (let o of e.not) if (_chkType(t, o)) return !1;
93102
return !0;
94103
}))), t;
95-
}, exports._optionsType = _optionsType, exports.chkType = chkType, exports.factory = factory,
96-
exports.process = process, exports.toFullEnglish = a, exports.toFullNumber = n,
97-
exports.toFullWidth = p, exports.toHalfEnglish = i, exports.toHalfNumber = f, exports.toHalfWidth = u;
104+
}, exports._optionsType = _optionsType, exports.chkType = chkType, exports.default = s,
105+
exports.factory = factory, exports.process = process, exports.toFullEnglish = a,
106+
exports.toFullNumber = n, exports.toFullWidth = u, exports.toHalfEnglish = i, exports.toHalfNumber = f,
107+
exports.toHalfWidth = p;
98108
//# sourceMappingURL=index.cjs.production.min.cjs.map

packages/@lazy-cjk/fullhalf/dist/index.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,17 @@ export interface IFactoryFn {
8484
(str: unknown, options: IOptions): string | number[];
8585
}
8686
export type ICharProcessor = (charCode: number) => number;
87+
declare const _default: {
88+
toFullNumber: IFactoryFn;
89+
toHalfNumber: IFactoryFn;
90+
toFullEnglish: IFactoryFn;
91+
toHalfEnglish: IFactoryFn;
92+
toFullWidth: IFactoryFn;
93+
toHalfWidth: IFactoryFn;
94+
};
95+
96+
export {
97+
_default as default,
98+
};
8799

88100
export {};

packages/@lazy-cjk/fullhalf/dist/index.esm.mjs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,39 @@ import o from "uni-string";
44

55
import { all as r } from "deepmerge";
66

7-
import { tableFullHalf as n, tableFullHalfDefaultInclude as f } from "@lazy-cjk/fullhalf-data";
7+
import { tableFullHalf as n, tableFullHalfDefaultInclude as l } from "@lazy-cjk/fullhalf-data";
88

9-
let l = {
9+
let f = {
1010
only: {
1111
number: !0
1212
}
1313
};
1414

15-
const i = factory(e, 1, l), y = factory(t, 0, l);
15+
const i = factory(e, 1, f), a = factory(t, 0, f);
1616

17-
l = {
17+
f = {
1818
only: {
1919
eng: !0
2020
}
2121
};
2222

23-
const a = factory(e, 1, l), p = factory(t, 0, l);
23+
const y = factory(e, 1, f), p = factory(t, 0, f);
2424

25-
l = {
25+
f = {
2626
only: {
2727
default: !0
2828
}
2929
};
3030

31-
const c = factory(e, 1, l), u = factory(t, 0, l);
31+
const u = factory(e, 1, f), c = factory(t, 0, f);
3232

3333
function _optionsType(e) {
3434
if (e) if ("boolean" == typeof e.exists) {
3535
for (let t in n[0]) 0 != t.indexOf("default") && !1 !== e[t] && (e[t] = e.exists);
3636
delete e.exists;
3737
} else {
3838
if ("boolean" == typeof e.default) {
39-
for (let t of f) !1 !== e[t] && (e[t] = e.default);
39+
for (let t of l) !1 !== e[t] && (e[t] = e.default);
4040
delete e.default;
4141
}
4242
"boolean" == typeof e.not_default2 && (e.both = e.space = e.not_default2, delete e.not_default2),
@@ -60,29 +60,29 @@ function chkType(e, t, o) {
6060
function process(e, t, r) {
6161
let n = [];
6262
r.skip = _optionsType(r.skip), r.only = _optionsType(r.only);
63-
let f = Array.isArray(e) ? e : new o(e);
64-
for (let e of f) {
65-
let o, f = "number" == typeof e ? e : e.codePointAt();
63+
let l = Array.isArray(e) ? e : new o(e);
64+
for (let e of l) {
65+
let o, l = "number" == typeof e ? e : e.codePointAt();
6666
if (r.only) {
6767
o = !0;
68-
for (let e in r.only) if (r.only[e] && chkType(f, e, r.type)) {
68+
for (let e in r.only) if (r.only[e] && chkType(l, e, r.type)) {
6969
o = !1;
7070
break;
7171
}
7272
}
73-
if (!o && r.skip) for (let e in r.skip) if (r.skip[e] && chkType(f, e, r.type)) {
73+
if (!o && r.skip) for (let e in r.skip) if (r.skip[e] && chkType(l, e, r.type)) {
7474
o = !0;
7575
break;
7676
}
77-
n.push(o ? f : t(f));
77+
n.push(o ? l : t(l));
7878
}
7979
return r.returnType ? n : String.fromCodePoint.apply(String, n);
8080
}
8181

8282
function factory(e, t, o) {
83-
return (n, f) => (f = r([ {}, f || {}, o || {}, {
83+
return (n, l) => (l = r([ {}, l || {}, o || {}, {
8484
type: t
85-
} ]), process(n, e, f));
85+
} ]), process(n, e, l));
8686
}
8787

8888
function _filterTable(e) {
@@ -94,5 +94,14 @@ function _filterTable(e) {
9494
}))), t;
9595
}
9696

97-
export { _chkType, _filterTable, _optionsType, chkType, factory, process, a as toFullEnglish, i as toFullNumber, c as toFullWidth, p as toHalfEnglish, y as toHalfNumber, u as toHalfWidth };
97+
var s = {
98+
toFullNumber: i,
99+
toHalfNumber: a,
100+
toFullEnglish: y,
101+
toHalfEnglish: p,
102+
toFullWidth: u,
103+
toHalfWidth: c
104+
};
105+
106+
export { _chkType, _filterTable, _optionsType, chkType, s as default, factory, process, y as toFullEnglish, i as toFullNumber, u as toFullWidth, p as toHalfEnglish, a as toHalfNumber, c as toHalfWidth };
98107
//# sourceMappingURL=index.esm.mjs.map

packages/@lazy-cjk/fullhalf/src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,3 +340,13 @@ export interface IFactoryFn
340340

341341
export type ICharProcessor = (charCode: number) => number
342342

343+
export default {
344+
toFullNumber,
345+
toHalfNumber,
346+
347+
toFullEnglish,
348+
toHalfEnglish,
349+
350+
toFullWidth,
351+
toHalfWidth,
352+
}

0 commit comments

Comments
 (0)