...
 
Commits (2)
{
"name": "utfu",
"version": "0.1.9",
"version": "0.2.0",
"@pika/pack": {
"pipeline": [
[
......
This diff is collapsed.
This diff is collapsed.
import mappings from "./mappings.js";
import { solo, duo, trio } from "./mappings.js";
const hex = str => {
if (typeof str !== 'string') throw new Error('utfu requires a string to process');
mappings.forEach(mapping => {
const hex = new RegExp(`${mapping.utf8}`, 'gu');
str = str.replace(hex, mapping.char);
trio.forEach(mapping => {
str = str.replace(mapping.misrender.regex, mapping.utf8.hex);
});
duo.forEach(mapping => {
str = str.replace(mapping.misrender.regex, mapping.utf8.hex);
});
solo.forEach(mapping => {
str = str.replace(mapping.misrender.regex, mapping.utf8.hex);
});
return str;
};
const txt = str => {
if (typeof str !== 'string') throw new Error('utfu requires a string to process');
mappings.forEach(mapping => {
const text = new RegExp(`${mapping.misrender}`, 'gu');
str = str.replace(text, mapping.utf8);
trio.forEach(mapping => {
str = str.replace(mapping.misrender.regex, mapping.utf8.char);
});
duo.forEach(mapping => {
str = str.replace(mapping.misrender.regex, mapping.utf8.char);
});
solo.forEach(mapping => {
str = str.replace(mapping.misrender.regex, mapping.utf8.char);
});
return str;
};
......
This diff is collapsed.
declare var _default: {
char: string;
utf_8: string;
misrender: string;
export const solo: ({
utf8: {
char: string;
regex: RegExp;
hex: string;
};
alt: {
char: string;
regex: RegExp;
hex: string;
}[];
misrender: {
chars: string;
regex: RegExp;
hex: string;
};
} | {
utf8: {
char: string;
regex: RegExp;
hex: string;
};
misrender: {
chars: string;
regex: RegExp;
hex: string;
};
alt?: undefined;
})[];
export const duo: {
utf8: {
char: string;
regex: RegExp;
hex: string;
};
misrender: {
chars: string;
regex: RegExp;
hex: string;
};
}[];
export const trio: {
utf8: {
char: string;
regex: RegExp;
hex: string;
};
misrender: {
chars: string;
regex: RegExp;
hex: string;
};
}[];
export default _default;
This diff is collapsed.
This diff is collapsed.
{
"name": "utfu",
"description": "Attempts to fix busted character encodings carried over from legacy text formats.",
"version": "0.1.9",
"version": "0.2.0",
"license": "MIT",
"files": [
"dist-*/",
......