1 Star 0 Fork 0

animalcoder/Vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.js 2.75 KB
一键复制 编辑 原始数据 按行查看 历史
animalcoder 提交于 2020-03-23 09:59 +08:00 . Vue6
'use strict';
const escapeStringRegexp = require('escape-string-regexp');
const platform = process.platform;
const main = {
tick: '',
cross: '',
star: '',
square: '',
squareSmall: '',
squareSmallFilled: '',
play: '',
circle: '',
circleFilled: '',
circleDotted: '',
circleDouble: '',
circleCircle: '',
circleCross: '',
circlePipe: '',
circleQuestionMark: '?⃝',
bullet: '',
dot: '',
line: '',
ellipsis: '',
pointer: '',
pointerSmall: '',
info: '',
warning: '',
hamburger: '',
smiley: '',
mustache: '',
heart: '',
arrowUp: '',
arrowDown: '',
arrowLeft: '',
arrowRight: '',
radioOn: '',
radioOff: '',
checkboxOn: '',
checkboxOff: '',
checkboxCircleOn: '',
checkboxCircleOff: '',
questionMarkPrefix: '?⃝',
oneHalf: '½',
oneThird: '',
oneQuarter: '¼',
oneFifth: '',
oneSixth: '',
oneSeventh: '',
oneEighth: '',
oneNinth: '',
oneTenth: '',
twoThirds: '',
twoFifths: '',
threeQuarters: '¾',
threeFifths: '',
threeEighths: '',
fourFifths: '',
fiveSixths: '',
fiveEighths: '',
sevenEighths: ''
};
const win = {
tick: '',
cross: '×',
star: '*',
square: '',
squareSmall: '[ ]',
squareSmallFilled: '[█]',
play: '',
circle: '( )',
circleFilled: '(*)',
circleDotted: '( )',
circleDouble: '( )',
circleCircle: '(○)',
circleCross: '(×)',
circlePipe: '(│)',
circleQuestionMark: '(?)',
bullet: '*',
dot: '.',
line: '',
ellipsis: '...',
pointer: '>',
pointerSmall: '»',
info: 'i',
warning: '',
hamburger: '',
smiley: '',
mustache: '┌─┐',
heart: main.heart,
arrowUp: main.arrowUp,
arrowDown: main.arrowDown,
arrowLeft: main.arrowLeft,
arrowRight: main.arrowRight,
radioOn: '(*)',
radioOff: '( )',
checkboxOn: '[×]',
checkboxOff: '[ ]',
checkboxCircleOn: '(×)',
checkboxCircleOff: '( )',
questionMarkPrefix: '',
oneHalf: '1/2',
oneThird: '1/3',
oneQuarter: '1/4',
oneFifth: '1/5',
oneSixth: '1/6',
oneSeventh: '1/7',
oneEighth: '1/8',
oneNinth: '1/9',
oneTenth: '1/10',
twoThirds: '2/3',
twoFifths: '2/5',
threeQuarters: '3/4',
threeFifths: '3/5',
threeEighths: '3/8',
fourFifths: '4/5',
fiveSixths: '5/6',
fiveEighths: '5/8',
sevenEighths: '7/8'
};
if (platform === 'linux') {
// the main one doesn't look that good on Ubuntu
main.questionMarkPrefix = '?';
}
const figures = platform === 'win32' ? win : main;
const fn = str => {
if (figures === main) {
return str;
}
Object.keys(main).forEach(key => {
if (main[key] === figures[key]) {
return;
}
str = str.replace(new RegExp(escapeStringRegexp(main[key]), 'g'), figures[key]);
});
return str;
};
module.exports = Object.assign(fn, figures);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/animalcoder/Vue.git
git@gitee.com:animalcoder/Vue.git
animalcoder
Vue
Vue
master

搜索帮助