| | |
| | | ele.className = ele.className.replace(reg, ' ')
|
| | | }
|
| | | }
|
| | |
|
| | | export function makeMap(str, expectsLowerCase) {
|
| | | const map = Object.create(null)
|
| | | const list = str.split(',')
|
| | | for (let i = 0; i < list.length; i++) {
|
| | | map[list[i]] = true
|
| | | }
|
| | | return expectsLowerCase
|
| | | ? val => map[val.toLowerCase()]
|
| | | : val => map[val]
|
| | | }
|
| | | |
| | | export const exportDefault = 'export default '
|
| | |
|
| | | export const beautifierConf = {
|
| | | html: {
|
| | | indent_size: '2',
|
| | | indent_char: ' ',
|
| | | max_preserve_newlines: '-1',
|
| | | preserve_newlines: false,
|
| | | keep_array_indentation: false,
|
| | | break_chained_methods: false,
|
| | | indent_scripts: 'separate',
|
| | | brace_style: 'end-expand',
|
| | | space_before_conditional: true,
|
| | | unescape_strings: false,
|
| | | jslint_happy: false,
|
| | | end_with_newline: true,
|
| | | wrap_line_length: '110',
|
| | | indent_inner_html: true,
|
| | | comma_first: false,
|
| | | e4x: true,
|
| | | indent_empty_lines: true
|
| | | },
|
| | | js: {
|
| | | indent_size: '2',
|
| | | indent_char: ' ',
|
| | | max_preserve_newlines: '-1',
|
| | | preserve_newlines: false,
|
| | | keep_array_indentation: false,
|
| | | break_chained_methods: false,
|
| | | indent_scripts: 'normal',
|
| | | brace_style: 'end-expand',
|
| | | space_before_conditional: true,
|
| | | unescape_strings: false,
|
| | | jslint_happy: true,
|
| | | end_with_newline: true,
|
| | | wrap_line_length: '110',
|
| | | indent_inner_html: true,
|
| | | comma_first: false,
|
| | | e4x: true,
|
| | | indent_empty_lines: true
|
| | | }
|
| | | }
|
| | |
|
| | | // 首字母大小
|
| | | export function titleCase(str) {
|
| | | return str.replace(/( |^)[a-z]/g, L => L.toUpperCase())
|
| | | }
|
| | |
|
| | | // 下划转驼峰
|
| | | export function camelCase(str) {
|
| | | return str.replace(/-[a-z]/g, str1 => str1.substr(-1).toUpperCase())
|
| | | }
|
| | |
|
| | | export function isNumberStr(str) {
|
| | | return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
|
| | | }
|
| | | |