@spare/string
Advanced tools
Comparing version 0.4.8 to 0.4.10
@@ -21,2 +21,8 @@ 'use strict'; | ||
*/ | ||
/** | ||
* | ||
* @param str | ||
* @return {boolean} | ||
* @deprecated | ||
*/ | ||
@@ -34,3 +40,3 @@ const hasChn = str => str.search(FullAngleReg) !== -1; | ||
* @returns {string} | ||
* @constructor | ||
* @deprecated | ||
*/ | ||
@@ -61,3 +67,3 @@ | ||
* @returns {string} | ||
* @constructor | ||
* @deprecated | ||
*/ | ||
@@ -78,2 +84,9 @@ | ||
/** | ||
* | ||
* @param tx | ||
* @return {string} | ||
* @deprecated | ||
*/ | ||
const toFullAngleWoAnsi = function (tx) { | ||
@@ -84,6 +97,2 @@ if (lange.hasAnsi(tx)) tx = stripAnsi(tx); | ||
const padStartAnsi = (tx, len, fill) => lange.hasAnsi(tx) ? tx.padStart(tx.length + len - lange.lange(tx), fill) : tx.padStart(len, fill); | ||
const padEndAnsi = (tx, len, fill) => lange.hasAnsi(tx) ? tx.padEnd(tx.length + len - lange.lange(tx), fill) : tx.padEnd(len, fill); | ||
const indexNonTab = tx => { | ||
@@ -111,2 +120,5 @@ let i = 0; | ||
const TB = ' '; | ||
const RN = '\r\n'; | ||
const wL = (tx = '') => { | ||
@@ -122,3 +134,3 @@ console.log(tx); | ||
const t = ' '.repeat(i); | ||
text = (text.endsWith('}') || text.endsWith(']')) && !text.endsWith(']]') ? util.afterNaTab(text.split(util.RN).map(x => t + x).join(util.RN)) : ['', ...text.split(util.RN).map(x => t + util.TB + x), t].join(util.RN); | ||
text = (text.endsWith('}') || text.endsWith(']')) && !text.endsWith(']]') ? util.afterNaTab(text.split(RN).map(x => t + x).join(RN)) : ['', ...text.split(RN).map(x => t + TB + x), t].join(RN); | ||
} | ||
@@ -134,4 +146,2 @@ | ||
exports.narrowExclude = narrowExclude; | ||
exports.padEndAnsi = padEndAnsi; | ||
exports.padStartAnsi = padStartAnsi; | ||
exports.tag = tag; | ||
@@ -138,0 +148,0 @@ exports.toFullAngle = toFullAngle; |
import stripAnsi from 'strip-ansi'; | ||
import { hasAnsi, lange } from '@spare/lange'; | ||
import { isTab, deNaTab, endsBracs, afterNaTab, RN, TB } from '@spare/util'; | ||
import { hasAnsi } from '@spare/lange'; | ||
import { isTab, deNaTab, endsBracs, afterNaTab } from '@spare/util'; | ||
@@ -15,2 +15,8 @@ const FullAngleReg = /[\u4e00-\u9fa5]|[\uff00-\uffff]/; | ||
*/ | ||
/** | ||
* | ||
* @param str | ||
* @return {boolean} | ||
* @deprecated | ||
*/ | ||
@@ -28,3 +34,3 @@ const hasChn = str => str.search(FullAngleReg) !== -1; | ||
* @returns {string} | ||
* @constructor | ||
* @deprecated | ||
*/ | ||
@@ -55,3 +61,3 @@ | ||
* @returns {string} | ||
* @constructor | ||
* @deprecated | ||
*/ | ||
@@ -72,2 +78,9 @@ | ||
/** | ||
* | ||
* @param tx | ||
* @return {string} | ||
* @deprecated | ||
*/ | ||
const toFullAngleWoAnsi = function (tx) { | ||
@@ -78,6 +91,2 @@ if (hasAnsi(tx)) tx = stripAnsi(tx); | ||
const padStartAnsi = (tx, len, fill) => hasAnsi(tx) ? tx.padStart(tx.length + len - lange(tx), fill) : tx.padStart(len, fill); | ||
const padEndAnsi = (tx, len, fill) => hasAnsi(tx) ? tx.padEnd(tx.length + len - lange(tx), fill) : tx.padEnd(len, fill); | ||
const indexNonTab = tx => { | ||
@@ -105,2 +114,5 @@ let i = 0; | ||
const TB = ' '; | ||
const RN = '\r\n'; | ||
const wL = (tx = '') => { | ||
@@ -122,2 +134,2 @@ console.log(tx); | ||
export { afterNonTab, hasChn, indexNonTab, narrow, narrowExclude, padEndAnsi, padStartAnsi, tag, toFullAngle, toFullAngleWoAnsi, toHalfAngle, wL }; | ||
export { afterNonTab, hasChn, indexNonTab, narrow, narrowExclude, tag, toFullAngle, toFullAngleWoAnsi, toHalfAngle, wL }; |
{ | ||
"name": "@spare/string", | ||
"version": "0.4.8", | ||
"version": "0.4.10", | ||
"description": "A debugging tool", | ||
@@ -18,5 +18,5 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"@spare/lange": "^0.4.8", | ||
"@spare/phrasing": "^0.4.8", | ||
"@spare/util": "^0.4.8", | ||
"@spare/lange": "^0.4.10", | ||
"@spare/phrasing": "^0.4.10", | ||
"@spare/util": "^0.4.10", | ||
"strip-ansi": "^6.0.0" | ||
@@ -40,3 +40,3 @@ }, | ||
"homepage": "https://github.com/hoyeungw/spare#readme", | ||
"gitHead": "3f16584e3fb33b541d675564302b52016f22dc4e" | ||
"gitHead": "c17b4a934ec23c9c9a0ec218206b0ba1e117fc85" | ||
} |
218
9828
Updated@spare/lange@^0.4.10
Updated@spare/phrasing@^0.4.10
Updated@spare/util@^0.4.10