fix: 修复 README 及代码中的拼写错误
This commit is contained in:
@@ -12,20 +12,20 @@ const DOUBLE_RIGHT_SLASH = '\\\\';
|
||||
export function pathConversion(targetPathType: SupportPathFormat, input: string, eol: EOL, cutText: Array<TransformTextResult> | undefined = undefined): string {
|
||||
let resultPath;
|
||||
|
||||
let isSeperator = false;
|
||||
let isSeparator = false;
|
||||
switch (targetPathType) {
|
||||
case SupportPathFormat.Windows:
|
||||
// 将其中的 / 替换为 \
|
||||
resultPath = Array.from(input).map((char: string) => {
|
||||
if (char !== LEFT_SLASH) {
|
||||
// 当前字符不是 /
|
||||
isSeperator = false;
|
||||
isSeparator = false;
|
||||
return char;
|
||||
} else {
|
||||
// 当前字符是 /
|
||||
if (!isSeperator) {
|
||||
if (!isSeparator) {
|
||||
// 上一字符不是 /
|
||||
isSeperator = true;
|
||||
isSeparator = true;
|
||||
return RIGHT_SLASH; // 替换成 \
|
||||
}
|
||||
// 上一字符是 /
|
||||
@@ -38,13 +38,13 @@ export function pathConversion(targetPathType: SupportPathFormat, input: string,
|
||||
resultPath = Array.from(input).map((char: string) => {
|
||||
if (char !== RIGHT_SLASH) {
|
||||
// 当前字符不是 \
|
||||
isSeperator = false;
|
||||
isSeparator = false;
|
||||
return char;
|
||||
} else {
|
||||
// 当前字符是 \
|
||||
if (!isSeperator) {
|
||||
if (!isSeparator) {
|
||||
// 上一字符不是 \
|
||||
isSeperator = true;
|
||||
isSeparator = true;
|
||||
return LEFT_SLASH; // 替换成 /
|
||||
}
|
||||
// 上一字符是 \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EOL } from '../../types/EOLType';
|
||||
import { SupportVariableCase } from './types/SupportVariableCaseType';
|
||||
import { TransformTextResult } from '../../types/TransformTextResultType';
|
||||
import { transformMutliLineText, transformText } from '../../utils/transform';
|
||||
import { transformMultiLineText } from '../../utils/transform';
|
||||
|
||||
/**
|
||||
* 统一文本转换函数
|
||||
@@ -52,7 +52,7 @@ export function caseConversion(targetCase: SupportVariableCase, str: string, eol
|
||||
}
|
||||
|
||||
// Cut text 切割文本
|
||||
const results: Array<TransformTextResult> = cutText === undefined ? transformMutliLineText(str) : cutText;
|
||||
const results: Array<TransformTextResult> = cutText === undefined ? transformMultiLineText(str) : cutText;
|
||||
// console.log('results', results);
|
||||
|
||||
const transformedLines: Array<string> = [];
|
||||
|
||||
Reference in New Issue
Block a user