@utilix-tech/sdk 0.84.0 → 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +5 -5
- package/dist/{chunk-RMXZMYSG.js → chunk-7XHM7HHU.js} +67 -1
- package/dist/{chunk-QVOK3BXM.js → chunk-FB6CCFR5.js} +77 -1
- package/dist/{chunk-OFLNVDNX.js → chunk-YM6UC4SM.js} +128 -1
- package/dist/{code-mkKV7BQ4.d.ts → code-B9LwFkB1.d.cts} +31 -2
- package/dist/{code-mkKV7BQ4.d.cts → code-B9LwFkB1.d.ts} +31 -2
- package/dist/index.cjs +269 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{text-CNn3whZA.d.cts → text-xY5MJwr0.d.cts} +34 -2
- package/dist/{text-CNn3whZA.d.ts → text-xY5MJwr0.d.ts} +34 -2
- package/dist/tools/code.cjs +66 -0
- package/dist/tools/code.d.cts +1 -1
- package/dist/tools/code.d.ts +1 -1
- package/dist/tools/code.js +1 -1
- package/dist/tools/text.cjs +76 -0
- package/dist/tools/text.d.cts +1 -1
- package/dist/tools/text.d.ts +1 -1
- package/dist/tools/text.js +1 -1
- package/dist/tools/units.cjs +127 -0
- package/dist/tools/units.d.cts +1 -1
- package/dist/tools/units.d.ts +1 -1
- package/dist/tools/units.js +1 -1
- package/dist/{units-D7YRRwei.d.cts → units-gLm_pq6U.d.cts} +73 -2
- package/dist/{units-D7YRRwei.d.ts → units-gLm_pq6U.d.ts} +73 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2319,6 +2319,7 @@ __export(text_exports, {
|
|
|
2319
2319
|
applyOps: () => applyOps,
|
|
2320
2320
|
calculateStringDistance: () => calculateStringDistance,
|
|
2321
2321
|
centerText: () => centerText,
|
|
2322
|
+
checkDashUsage: () => checkDashUsage,
|
|
2322
2323
|
checkOxfordCommaConsistency: () => checkOxfordCommaConsistency,
|
|
2323
2324
|
convertAll: () => convertAll,
|
|
2324
2325
|
convertCase: () => convertCase,
|
|
@@ -5492,6 +5493,81 @@ function checkOxfordCommaConsistency(text) {
|
|
|
5492
5493
|
const consistent = withOxfordComma === 0 || withoutOxfordComma === 0;
|
|
5493
5494
|
return { totalLists: instances.length, withOxfordComma, withoutOxfordComma, consistent, instances };
|
|
5494
5495
|
}
|
|
5496
|
+
function dashContextSnippet(text, index, matchLen) {
|
|
5497
|
+
const start = Math.max(0, index - 20);
|
|
5498
|
+
const end = Math.min(text.length, index + matchLen + 20);
|
|
5499
|
+
const body = text.slice(start, end).replace(/\s+/g, " ").trim();
|
|
5500
|
+
return (start > 0 ? "\u2026" : "") + body + (end < text.length ? "\u2026" : "");
|
|
5501
|
+
}
|
|
5502
|
+
function checkDashUsage(text) {
|
|
5503
|
+
const issues = [];
|
|
5504
|
+
const enDashCount = (text.match(/–/g) ?? []).length;
|
|
5505
|
+
const hyphenCount = (text.match(/-/g) ?? []).length;
|
|
5506
|
+
const doubleHyphenMatches = [...text.matchAll(/-{2,}/g)];
|
|
5507
|
+
for (const m of doubleHyphenMatches) {
|
|
5508
|
+
const index = m.index ?? 0;
|
|
5509
|
+
issues.push({
|
|
5510
|
+
type: "double-hyphen",
|
|
5511
|
+
index,
|
|
5512
|
+
context: dashContextSnippet(text, index, m[0].length),
|
|
5513
|
+
message: `Found ${m[0].length} consecutive hyphens ("${m[0]}"); likely meant to be an em dash (\u2014) or en dash (\u2013).`
|
|
5514
|
+
});
|
|
5515
|
+
}
|
|
5516
|
+
const spacedHyphenMatches = [...text.matchAll(/(?<=\S) - (?=\S)/g)];
|
|
5517
|
+
for (const m of spacedHyphenMatches) {
|
|
5518
|
+
const index = m.index ?? 0;
|
|
5519
|
+
issues.push({
|
|
5520
|
+
type: "spaced-hyphen",
|
|
5521
|
+
index,
|
|
5522
|
+
context: dashContextSnippet(text, index, m[0].length),
|
|
5523
|
+
message: "A hyphen surrounded by spaces usually signals an intended em dash (\u2014), not a hyphenated compound word."
|
|
5524
|
+
});
|
|
5525
|
+
}
|
|
5526
|
+
const emDashOccurrences = [...text.matchAll(/—/g)];
|
|
5527
|
+
let spacedEm = 0;
|
|
5528
|
+
let unspacedEm = 0;
|
|
5529
|
+
for (const m of emDashOccurrences) {
|
|
5530
|
+
const idx = m.index ?? 0;
|
|
5531
|
+
const before = text[idx - 1];
|
|
5532
|
+
const after = text[idx + 1];
|
|
5533
|
+
if (before === " " && after === " ") spacedEm++;
|
|
5534
|
+
else if (before !== " " && after !== " ") unspacedEm++;
|
|
5535
|
+
}
|
|
5536
|
+
let dominantEmDashStyle = "none";
|
|
5537
|
+
let emDashSpacingConsistent = true;
|
|
5538
|
+
if (emDashOccurrences.length > 0) {
|
|
5539
|
+
dominantEmDashStyle = spacedEm >= unspacedEm ? "spaced" : "unspaced";
|
|
5540
|
+
emDashSpacingConsistent = spacedEm === 0 || unspacedEm === 0;
|
|
5541
|
+
if (!emDashSpacingConsistent) {
|
|
5542
|
+
for (const m of emDashOccurrences) {
|
|
5543
|
+
const idx = m.index ?? 0;
|
|
5544
|
+
const before = text[idx - 1];
|
|
5545
|
+
const after = text[idx + 1];
|
|
5546
|
+
const isSpaced = before === " " && after === " ";
|
|
5547
|
+
const matchesDominant = dominantEmDashStyle === "spaced" ? isSpaced : !isSpaced;
|
|
5548
|
+
if (!matchesDominant) {
|
|
5549
|
+
issues.push({
|
|
5550
|
+
type: "inconsistent-em-dash-spacing",
|
|
5551
|
+
index: idx,
|
|
5552
|
+
context: dashContextSnippet(text, idx, 1),
|
|
5553
|
+
message: `This em dash is ${isSpaced ? "spaced" : "unspaced"}, but the document mostly uses ${dominantEmDashStyle} em dashes.`
|
|
5554
|
+
});
|
|
5555
|
+
}
|
|
5556
|
+
}
|
|
5557
|
+
}
|
|
5558
|
+
}
|
|
5559
|
+
issues.sort((a, b) => a.index - b.index);
|
|
5560
|
+
return {
|
|
5561
|
+
emDashCount: emDashOccurrences.length,
|
|
5562
|
+
enDashCount,
|
|
5563
|
+
hyphenCount,
|
|
5564
|
+
doubleHyphenCount: doubleHyphenMatches.length,
|
|
5565
|
+
spacedHyphenCount: spacedHyphenMatches.length,
|
|
5566
|
+
emDashSpacingConsistent,
|
|
5567
|
+
dominantEmDashStyle,
|
|
5568
|
+
issues
|
|
5569
|
+
};
|
|
5570
|
+
}
|
|
5495
5571
|
|
|
5496
5572
|
// src/tools/data.ts
|
|
5497
5573
|
var data_exports = {};
|
|
@@ -8943,6 +9019,7 @@ __export(units_exports, {
|
|
|
8943
9019
|
calculateCdMaturity: () => calculateCdMaturity,
|
|
8944
9020
|
calculateChange: () => calculateChange,
|
|
8945
9021
|
calculateCompoundInterest: () => calculateCompoundInterest,
|
|
9022
|
+
calculateCreditCardMinimumPayment: () => calculateCreditCardMinimumPayment,
|
|
8946
9023
|
calculateCreditUtilization: () => calculateCreditUtilization,
|
|
8947
9024
|
calculateDebtToIncomeRatio: () => calculateDebtToIncomeRatio,
|
|
8948
9025
|
calculateDepreciationSchedule: () => calculateDepreciationSchedule,
|
|
@@ -8963,6 +9040,7 @@ __export(units_exports, {
|
|
|
8963
9040
|
calculateRequiredBandwidth: () => calculateRequiredBandwidth,
|
|
8964
9041
|
calculateRoi: () => calculateRoi,
|
|
8965
9042
|
calculateRuleOf72: () => calculateRuleOf72,
|
|
9043
|
+
calculateSalesCommission: () => calculateSalesCommission,
|
|
8966
9044
|
calculateSavingsGoal: () => calculateSavingsGoal,
|
|
8967
9045
|
calculateSimpleInterest: () => calculateSimpleInterest,
|
|
8968
9046
|
calculateTax: () => calculateTax,
|
|
@@ -11722,6 +11800,131 @@ function calculateRealRateOfReturn(input) {
|
|
|
11722
11800
|
solvedFor
|
|
11723
11801
|
};
|
|
11724
11802
|
}
|
|
11803
|
+
var CREDIT_CARD_MIN_PAYMENT_MAX_MONTHS = 1200;
|
|
11804
|
+
function calculateCreditCardMinimumPayment(balance, aprPercent, minPaymentPercent, minPaymentFloor = 0) {
|
|
11805
|
+
if (!Number.isFinite(balance) || balance <= 0) {
|
|
11806
|
+
return { error: "balance must be a finite number greater than zero" };
|
|
11807
|
+
}
|
|
11808
|
+
if (!Number.isFinite(aprPercent) || aprPercent < 0) {
|
|
11809
|
+
return { error: "aprPercent must be a finite, non-negative number" };
|
|
11810
|
+
}
|
|
11811
|
+
if (!Number.isFinite(minPaymentPercent) || minPaymentPercent <= 0) {
|
|
11812
|
+
return { error: "minPaymentPercent must be a finite number greater than zero" };
|
|
11813
|
+
}
|
|
11814
|
+
if (!Number.isFinite(minPaymentFloor) || minPaymentFloor < 0) {
|
|
11815
|
+
return { error: "minPaymentFloor must be a finite, non-negative number" };
|
|
11816
|
+
}
|
|
11817
|
+
const round23 = (n) => Math.round(n * 100) / 100;
|
|
11818
|
+
const monthlyRate = aprPercent / 100 / 12;
|
|
11819
|
+
let bal = balance;
|
|
11820
|
+
let totalInterestPaid = 0;
|
|
11821
|
+
let totalPaid = 0;
|
|
11822
|
+
let firstMonthPayment = 0;
|
|
11823
|
+
let finalMonthPayment = 0;
|
|
11824
|
+
let month = 0;
|
|
11825
|
+
while (bal > 5e-3 && month < CREDIT_CARD_MIN_PAYMENT_MAX_MONTHS) {
|
|
11826
|
+
month++;
|
|
11827
|
+
const interest = bal * monthlyRate;
|
|
11828
|
+
bal += interest;
|
|
11829
|
+
totalInterestPaid += interest;
|
|
11830
|
+
let payment = Math.max(bal * (minPaymentPercent / 100), minPaymentFloor);
|
|
11831
|
+
if (payment > bal) payment = bal;
|
|
11832
|
+
bal -= payment;
|
|
11833
|
+
totalPaid += payment;
|
|
11834
|
+
finalMonthPayment = round23(payment);
|
|
11835
|
+
if (month === 1) firstMonthPayment = round23(payment);
|
|
11836
|
+
}
|
|
11837
|
+
if (bal > 5e-3) {
|
|
11838
|
+
return {
|
|
11839
|
+
error: `balance cannot be paid off within ${CREDIT_CARD_MIN_PAYMENT_MAX_MONTHS} months at this minimum-payment formula; increase minPaymentPercent or minPaymentFloor`
|
|
11840
|
+
};
|
|
11841
|
+
}
|
|
11842
|
+
return {
|
|
11843
|
+
monthsToPayoff: month,
|
|
11844
|
+
yearsToPayoff: round23(month / 12),
|
|
11845
|
+
totalInterestPaid: round23(totalInterestPaid),
|
|
11846
|
+
totalPaid: round23(totalPaid),
|
|
11847
|
+
firstMonthPayment,
|
|
11848
|
+
finalMonthPayment
|
|
11849
|
+
};
|
|
11850
|
+
}
|
|
11851
|
+
function calculateSalesCommission(input) {
|
|
11852
|
+
const { salesAmount, flatRatePercent, tiers, baseSalary = 0 } = input;
|
|
11853
|
+
if (!Number.isFinite(salesAmount) || salesAmount < 0) {
|
|
11854
|
+
return { error: "salesAmount must be a finite, non-negative number" };
|
|
11855
|
+
}
|
|
11856
|
+
if (!Number.isFinite(baseSalary) || baseSalary < 0) {
|
|
11857
|
+
return { error: "baseSalary must be a finite, non-negative number when provided" };
|
|
11858
|
+
}
|
|
11859
|
+
const hasFlat = flatRatePercent !== void 0;
|
|
11860
|
+
const hasTiers = tiers !== void 0;
|
|
11861
|
+
if (hasFlat === hasTiers) {
|
|
11862
|
+
return { error: "Provide exactly one of flatRatePercent or tiers, not both and not neither" };
|
|
11863
|
+
}
|
|
11864
|
+
const round4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
11865
|
+
if (hasFlat) {
|
|
11866
|
+
if (!Number.isFinite(flatRatePercent) || flatRatePercent < 0) {
|
|
11867
|
+
return { error: "flatRatePercent must be a finite, non-negative number" };
|
|
11868
|
+
}
|
|
11869
|
+
const commission2 = salesAmount * flatRatePercent / 100;
|
|
11870
|
+
return {
|
|
11871
|
+
salesAmount: round4(salesAmount),
|
|
11872
|
+
mode: "flat",
|
|
11873
|
+
commission: round4(commission2),
|
|
11874
|
+
baseSalary: round4(baseSalary),
|
|
11875
|
+
totalPayout: round4(baseSalary + commission2)
|
|
11876
|
+
};
|
|
11877
|
+
}
|
|
11878
|
+
const tierList = tiers;
|
|
11879
|
+
if (tierList.length === 0) {
|
|
11880
|
+
return { error: "tiers must contain at least one entry" };
|
|
11881
|
+
}
|
|
11882
|
+
let previousUpTo = 0;
|
|
11883
|
+
for (let i = 0; i < tierList.length; i++) {
|
|
11884
|
+
const tier = tierList[i];
|
|
11885
|
+
const isLast = i === tierList.length - 1;
|
|
11886
|
+
if (!Number.isFinite(tier.ratePercent) || tier.ratePercent < 0) {
|
|
11887
|
+
return { error: `tiers[${i}].ratePercent must be a finite, non-negative number` };
|
|
11888
|
+
}
|
|
11889
|
+
if (tier.upTo === null) {
|
|
11890
|
+
if (!isLast) {
|
|
11891
|
+
return { error: `tiers[${i}].upTo may only be null on the last tier (an unbounded top tier)` };
|
|
11892
|
+
}
|
|
11893
|
+
} else {
|
|
11894
|
+
if (!Number.isFinite(tier.upTo) || tier.upTo <= previousUpTo) {
|
|
11895
|
+
return {
|
|
11896
|
+
error: `tiers[${i}].upTo must be a finite number greater than the previous tier's upTo (${previousUpTo})`
|
|
11897
|
+
};
|
|
11898
|
+
}
|
|
11899
|
+
previousUpTo = tier.upTo;
|
|
11900
|
+
}
|
|
11901
|
+
}
|
|
11902
|
+
let lowerBound = 0;
|
|
11903
|
+
let commission = 0;
|
|
11904
|
+
const breakdown = [];
|
|
11905
|
+
for (const tier of tierList) {
|
|
11906
|
+
const upper = tier.upTo === null ? Infinity : tier.upTo;
|
|
11907
|
+
const amountInRange = Math.min(Math.max(salesAmount - lowerBound, 0), upper - lowerBound);
|
|
11908
|
+
const commissionForRange = amountInRange * tier.ratePercent / 100;
|
|
11909
|
+
commission += commissionForRange;
|
|
11910
|
+
breakdown.push({
|
|
11911
|
+
rangeStart: round4(lowerBound),
|
|
11912
|
+
rangeEnd: tier.upTo === null ? null : round4(tier.upTo),
|
|
11913
|
+
ratePercent: tier.ratePercent,
|
|
11914
|
+
amountInRange: round4(amountInRange),
|
|
11915
|
+
commissionForRange: round4(commissionForRange)
|
|
11916
|
+
});
|
|
11917
|
+
lowerBound = upper;
|
|
11918
|
+
}
|
|
11919
|
+
return {
|
|
11920
|
+
salesAmount: round4(salesAmount),
|
|
11921
|
+
mode: "tiered",
|
|
11922
|
+
commission: round4(commission),
|
|
11923
|
+
baseSalary: round4(baseSalary),
|
|
11924
|
+
totalPayout: round4(baseSalary + commission),
|
|
11925
|
+
breakdown
|
|
11926
|
+
};
|
|
11927
|
+
}
|
|
11725
11928
|
|
|
11726
11929
|
// src/tools/network.ts
|
|
11727
11930
|
var network_exports = {};
|
|
@@ -16814,6 +17017,7 @@ __export(code_exports, {
|
|
|
16814
17017
|
SQL_DEFAULT_OPTIONS: () => SQL_DEFAULT_OPTIONS,
|
|
16815
17018
|
analyzeRegexGroups: () => analyzeRegexGroups,
|
|
16816
17019
|
auditDependencyRanges: () => auditDependencyRanges,
|
|
17020
|
+
buildCharacterClass: () => buildCharacterClass,
|
|
16817
17021
|
buildDockerPull: () => buildDockerPull,
|
|
16818
17022
|
buildDockerRun: () => buildDockerRun,
|
|
16819
17023
|
buildGitCommand: () => buildGitCommand,
|
|
@@ -21234,6 +21438,71 @@ function extractMarkdownLinkReferences(markdown) {
|
|
|
21234
21438
|
unusedDefinitions
|
|
21235
21439
|
};
|
|
21236
21440
|
}
|
|
21441
|
+
var CHAR_CLASS_SPECIAL_CHARS = /* @__PURE__ */ new Set(["]", "\\", "^", "-"]);
|
|
21442
|
+
function escapeForCharClass(ch) {
|
|
21443
|
+
return CHAR_CLASS_SPECIAL_CHARS.has(ch) ? `\\${ch}` : ch;
|
|
21444
|
+
}
|
|
21445
|
+
var CHAR_CLASS_RANGE_RE = /^(.)-(.)$/u;
|
|
21446
|
+
function buildCharacterClass(options) {
|
|
21447
|
+
const {
|
|
21448
|
+
lowercase = false,
|
|
21449
|
+
uppercase = false,
|
|
21450
|
+
digits = false,
|
|
21451
|
+
whitespace = false,
|
|
21452
|
+
customRanges = [],
|
|
21453
|
+
customChars = "",
|
|
21454
|
+
negate = false
|
|
21455
|
+
} = options ?? {};
|
|
21456
|
+
const hasAny = lowercase || uppercase || digits || whitespace || customRanges.length > 0 || customChars.length > 0;
|
|
21457
|
+
if (!hasAny) {
|
|
21458
|
+
return { error: "At least one character set, custom range, or custom character must be specified" };
|
|
21459
|
+
}
|
|
21460
|
+
const parts = [];
|
|
21461
|
+
const includes = [];
|
|
21462
|
+
if (lowercase) {
|
|
21463
|
+
parts.push("a-z");
|
|
21464
|
+
includes.push("a-z: lowercase letters");
|
|
21465
|
+
}
|
|
21466
|
+
if (uppercase) {
|
|
21467
|
+
parts.push("A-Z");
|
|
21468
|
+
includes.push("A-Z: uppercase letters");
|
|
21469
|
+
}
|
|
21470
|
+
if (digits) {
|
|
21471
|
+
parts.push("0-9");
|
|
21472
|
+
includes.push("0-9: digits");
|
|
21473
|
+
}
|
|
21474
|
+
if (whitespace) {
|
|
21475
|
+
parts.push("\\s");
|
|
21476
|
+
includes.push("\\s: whitespace characters (space, tab, newline, etc.)");
|
|
21477
|
+
}
|
|
21478
|
+
for (let i = 0; i < customRanges.length; i++) {
|
|
21479
|
+
const range = customRanges[i];
|
|
21480
|
+
const match = CHAR_CLASS_RANGE_RE.exec(range);
|
|
21481
|
+
if (!match) {
|
|
21482
|
+
return { error: `customRanges[${i}] ("${range}") must be exactly two characters joined by a hyphen, e.g. "f-k"` };
|
|
21483
|
+
}
|
|
21484
|
+
const [, start, end] = match;
|
|
21485
|
+
if (start.codePointAt(0) > end.codePointAt(0)) {
|
|
21486
|
+
return { error: `customRanges[${i}] ("${range}") has a start character that comes after its end character` };
|
|
21487
|
+
}
|
|
21488
|
+
parts.push(`${escapeForCharClass(start)}-${escapeForCharClass(end)}`);
|
|
21489
|
+
includes.push(`${range}: custom range from '${start}' to '${end}' inclusive`);
|
|
21490
|
+
}
|
|
21491
|
+
if (customChars.length > 0) {
|
|
21492
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21493
|
+
const unique = [];
|
|
21494
|
+
for (const ch of customChars) {
|
|
21495
|
+
if (!seen.has(ch)) {
|
|
21496
|
+
seen.add(ch);
|
|
21497
|
+
unique.push(ch);
|
|
21498
|
+
}
|
|
21499
|
+
}
|
|
21500
|
+
parts.push(unique.map(escapeForCharClass).join(""));
|
|
21501
|
+
includes.push(`custom characters: ${unique.join(", ")}`);
|
|
21502
|
+
}
|
|
21503
|
+
const pattern = `[${negate ? "^" : ""}${parts.join("")}]`;
|
|
21504
|
+
return { pattern, negate, includes };
|
|
21505
|
+
}
|
|
21237
21506
|
|
|
21238
21507
|
// src/tools/color.ts
|
|
21239
21508
|
var color_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export { j as json } from './json-Ca6gZCNB.cjs';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.cjs';
|
|
3
3
|
export { h as hashing } from './hashing-CJjlvqS_.cjs';
|
|
4
|
-
export { t as text } from './text-
|
|
4
|
+
export { t as text } from './text-xY5MJwr0.cjs';
|
|
5
5
|
export { d as data } from './data-DIyBrJ6l.cjs';
|
|
6
6
|
export { g as generators } from './generators-DAXXrMvG.cjs';
|
|
7
7
|
export { t as time } from './time-VMAy_SrV.cjs';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-gLm_pq6U.cjs';
|
|
9
9
|
export { n as network } from './network-ylRtLPEs.cjs';
|
|
10
10
|
export { a as api } from './api-CQnIUrVB.cjs';
|
|
11
|
-
export { c as code } from './code-
|
|
11
|
+
export { c as code } from './code-B9LwFkB1.cjs';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.cjs';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.cjs';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export { j as json } from './json-Ca6gZCNB.js';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.js';
|
|
3
3
|
export { h as hashing } from './hashing-CJjlvqS_.js';
|
|
4
|
-
export { t as text } from './text-
|
|
4
|
+
export { t as text } from './text-xY5MJwr0.js';
|
|
5
5
|
export { d as data } from './data-DIyBrJ6l.js';
|
|
6
6
|
export { g as generators } from './generators-DAXXrMvG.js';
|
|
7
7
|
export { t as time } from './time-VMAy_SrV.js';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-gLm_pq6U.js';
|
|
9
9
|
export { n as network } from './network-ylRtLPEs.js';
|
|
10
10
|
export { a as api } from './api-CQnIUrVB.js';
|
|
11
|
-
export { c as code } from './code-
|
|
11
|
+
export { c as code } from './code-B9LwFkB1.js';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.js';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.js';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { media_exports as media } from './chunk-ZWFZRDQ4.js';
|
|
2
|
-
export { units_exports as units } from './chunk-
|
|
2
|
+
export { units_exports as units } from './chunk-YM6UC4SM.js';
|
|
3
3
|
export { network_exports as network } from './chunk-SW3J5CAI.js';
|
|
4
4
|
export { api_exports as api } from './chunk-U2HREMZU.js';
|
|
5
|
-
export { code_exports as code } from './chunk-
|
|
5
|
+
export { code_exports as code } from './chunk-7XHM7HHU.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
7
7
|
export { css_exports as css } from './chunk-6YPV2AB5.js';
|
|
8
8
|
export { misc_exports as misc } from './chunk-GX7H6TAX.js';
|
|
@@ -10,7 +10,7 @@ export { ai_agent_exports as ai_agent } from './chunk-5VVC7BHS.js';
|
|
|
10
10
|
export { json_exports as json } from './chunk-WUOZHCIC.js';
|
|
11
11
|
export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
|
|
12
12
|
export { hashing_exports as hashing } from './chunk-PET2CGTH.js';
|
|
13
|
-
export { text_exports as text } from './chunk-
|
|
13
|
+
export { text_exports as text } from './chunk-FB6CCFR5.js';
|
|
14
14
|
export { data_exports as data } from './chunk-XOUS3M5Z.js';
|
|
15
15
|
export { generators_exports as generators } from './chunk-422ICOZX.js';
|
|
16
16
|
export { time_exports as time } from './chunk-6EJVNQSY.js';
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* - sentence-length-distribution: analyzeSentenceLengths
|
|
26
26
|
* - keyword-density-analyzer: analyzeKeywordDensity
|
|
27
27
|
* - emoji-lookup : searchEmoji, getEmojiByShortcode, getEmojiByChar, getEmojiByCategory, getEmojiCategories, EMOJI_TABLE
|
|
28
|
+
* - em-dash-usage-checker: checkDashUsage
|
|
28
29
|
*/
|
|
29
30
|
interface WordCountResult {
|
|
30
31
|
words: number;
|
|
@@ -456,6 +457,33 @@ interface OxfordCommaResult {
|
|
|
456
457
|
* be counted as part of a list.
|
|
457
458
|
*/
|
|
458
459
|
declare function checkOxfordCommaConsistency(text: string): OxfordCommaResult;
|
|
460
|
+
type DashIssueType = 'spaced-hyphen' | 'double-hyphen' | 'inconsistent-em-dash-spacing';
|
|
461
|
+
interface DashIssue {
|
|
462
|
+
type: DashIssueType;
|
|
463
|
+
index: number;
|
|
464
|
+
context: string;
|
|
465
|
+
message: string;
|
|
466
|
+
}
|
|
467
|
+
interface DashUsageResult {
|
|
468
|
+
emDashCount: number;
|
|
469
|
+
enDashCount: number;
|
|
470
|
+
hyphenCount: number;
|
|
471
|
+
doubleHyphenCount: number;
|
|
472
|
+
spacedHyphenCount: number;
|
|
473
|
+
emDashSpacingConsistent: boolean;
|
|
474
|
+
dominantEmDashStyle: 'spaced' | 'unspaced' | 'none';
|
|
475
|
+
issues: DashIssue[];
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Scan text for likely dash misuse: a hyphen surrounded by spaces where an
|
|
479
|
+
* em dash is probably intended ("word - word"), a double hyphen ("--")
|
|
480
|
+
* left unconverted from a plain-ASCII source, and inconsistent spacing
|
|
481
|
+
* around em dashes across the same document (mixing "word — word" and
|
|
482
|
+
* "word—word"). Pure regex heuristic over the raw characters; it doesn't
|
|
483
|
+
* parse grammar, so a legitimately hyphenated range or a code sample
|
|
484
|
+
* pasted alongside prose can occasionally be flagged.
|
|
485
|
+
*/
|
|
486
|
+
declare function checkDashUsage(text: string): DashUsageResult;
|
|
459
487
|
|
|
460
488
|
type text_AsciiFont = AsciiFont;
|
|
461
489
|
type text_AsciiOptions = AsciiOptions;
|
|
@@ -463,6 +491,9 @@ declare const text_CASE_FORMATS: typeof CASE_FORMATS;
|
|
|
463
491
|
type text_CaseFormat = CaseFormat;
|
|
464
492
|
type text_ConvertOptions = ConvertOptions;
|
|
465
493
|
declare const text_DEFAULT_CONVERT_OPTIONS: typeof DEFAULT_CONVERT_OPTIONS;
|
|
494
|
+
type text_DashIssue = DashIssue;
|
|
495
|
+
type text_DashIssueType = DashIssueType;
|
|
496
|
+
type text_DashUsageResult = DashUsageResult;
|
|
466
497
|
type text_DiffFile = DiffFile;
|
|
467
498
|
type text_DiffHunk = DiffHunk;
|
|
468
499
|
type text_DiffLine = DiffLine;
|
|
@@ -513,6 +544,7 @@ declare const text_applyOp: typeof applyOp;
|
|
|
513
544
|
declare const text_applyOps: typeof applyOps;
|
|
514
545
|
declare const text_calculateStringDistance: typeof calculateStringDistance;
|
|
515
546
|
declare const text_centerText: typeof centerText;
|
|
547
|
+
declare const text_checkDashUsage: typeof checkDashUsage;
|
|
516
548
|
declare const text_checkOxfordCommaConsistency: typeof checkOxfordCommaConsistency;
|
|
517
549
|
declare const text_convertAll: typeof convertAll;
|
|
518
550
|
declare const text_convertCase: typeof convertCase;
|
|
@@ -568,7 +600,7 @@ declare const text_textToMorse: typeof textToMorse;
|
|
|
568
600
|
declare const text_unescapeString: typeof unescapeString;
|
|
569
601
|
declare const text_wordFrequency: typeof wordFrequency;
|
|
570
602
|
declare namespace text {
|
|
571
|
-
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_OxfordCommaInstance as OxfordCommaInstance, type text_OxfordCommaResult as OxfordCommaResult, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, type text_WordyPhraseMatch as WordyPhraseMatch, type text_WordyPhraseResult as WordyPhraseResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_checkOxfordCommaConsistency as checkOxfordCommaConsistency, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_detectWordyPhrases as detectWordyPhrases, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
603
|
+
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DashIssue as DashIssue, type text_DashIssueType as DashIssueType, type text_DashUsageResult as DashUsageResult, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_OxfordCommaInstance as OxfordCommaInstance, type text_OxfordCommaResult as OxfordCommaResult, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, type text_WordyPhraseMatch as WordyPhraseMatch, type text_WordyPhraseResult as WordyPhraseResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_checkDashUsage as checkDashUsage, text_checkOxfordCommaConsistency as checkOxfordCommaConsistency, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_detectWordyPhrases as detectWordyPhrases, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
572
604
|
}
|
|
573
605
|
|
|
574
|
-
export {
|
|
606
|
+
export { analyzeKeywordDensity as $, type AsciiFont as A, type ParsedTable as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, EMOJI_TABLE as E, type FillerCategory as F, type PassiveVoiceMatch as G, type PassiveVoiceResult as H, type PassiveVoiceSentence as I, type ReadabilityScore as J, type KeywordDensityEntry as K, LINE_OPS as L, MORSE_CODE as M, type SentenceLengthDistribution as N, type OxfordCommaInstance as O, type ParsedDiff as P, type SlugSeparator as Q, type ReadabilityResult as R, type SentenceLengthBucket as S, type StringDistanceMode as T, type StringDistanceResult as U, type TableOptions as V, type TextAnalysis as W, type WordCountResult as X, type WordyPhraseMatch as Y, type WordyPhraseResult as Z, addBorder as _, type AsciiOptions as a, analyzeSentenceLengths as a0, analyzeText as a1, applyOp as a2, applyOps as a3, calculateStringDistance as a4, centerText as a5, checkDashUsage as a6, checkOxfordCommaConsistency as a7, convertAll as a8, convertCase as a9, getMorseForChar as aA, getMorseTiming as aB, htmlToMarkdown as aC, isValidMorse as aD, markdownToHtml as aE, morseToText as aF, numberToOrdinal as aG, numberToRoman as aH, numberToWords as aI, ordinalWords as aJ, parseDiff as aK, parseTableData as aL, readabilityScore as aM, renderMarkdown as aN, romanToNumber as aO, scoreReadability as aP, searchEmoji as aQ, sentenceCount as aR, slugify as aS, slugifyAll as aT, syllableCount as aU, textToAscii as aV, textToMorse as aW, unescapeString as aX, wordFrequency as aY, countWords as aa, csvToHtml as ab, csvToMarkdown as ac, detectDelimiter as ad, detectFillerWords as ae, detectPassiveVoice as af, detectWordyPhrases as ag, diffLines as ah, diffLinesSimple as ai, diffStats as aj, escapeAll as ak, escapeString as al, extractHeadings as am, formatReadingTime as an, generate as ao, generateDiff as ap, generateHtmlTable as aq, generateMarkdownTable as ar, generateParagraphs as as, generateSentences as at, generateWords as au, getAvailableFonts as av, getEmojiByCategory as aw, getEmojiByChar as ax, getEmojiByShortcode as ay, getEmojiCategories as az, type CaseFormat as b, type ConvertOptions as c, type DashIssue as d, type DashIssueType as e, type DashUsageResult as f, type DiffFile as g, type DiffHunk as h, type DiffLine as i, type DiffResult as j, type DiffType as k, type DiffViewerLine as l, ESCAPE_MODES as m, type EmojiEntry as n, type EscapeMode as o, type FillerMatch as p, type FillerWordResult as q, type KeywordDensityOptions as r, type KeywordDensityResult as s, text as t, type LineOp as u, type LineType as v, type LoremUnit as w, type MarkdownResult as x, type MorseOptions as y, type OxfordCommaResult as z };
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* - sentence-length-distribution: analyzeSentenceLengths
|
|
26
26
|
* - keyword-density-analyzer: analyzeKeywordDensity
|
|
27
27
|
* - emoji-lookup : searchEmoji, getEmojiByShortcode, getEmojiByChar, getEmojiByCategory, getEmojiCategories, EMOJI_TABLE
|
|
28
|
+
* - em-dash-usage-checker: checkDashUsage
|
|
28
29
|
*/
|
|
29
30
|
interface WordCountResult {
|
|
30
31
|
words: number;
|
|
@@ -456,6 +457,33 @@ interface OxfordCommaResult {
|
|
|
456
457
|
* be counted as part of a list.
|
|
457
458
|
*/
|
|
458
459
|
declare function checkOxfordCommaConsistency(text: string): OxfordCommaResult;
|
|
460
|
+
type DashIssueType = 'spaced-hyphen' | 'double-hyphen' | 'inconsistent-em-dash-spacing';
|
|
461
|
+
interface DashIssue {
|
|
462
|
+
type: DashIssueType;
|
|
463
|
+
index: number;
|
|
464
|
+
context: string;
|
|
465
|
+
message: string;
|
|
466
|
+
}
|
|
467
|
+
interface DashUsageResult {
|
|
468
|
+
emDashCount: number;
|
|
469
|
+
enDashCount: number;
|
|
470
|
+
hyphenCount: number;
|
|
471
|
+
doubleHyphenCount: number;
|
|
472
|
+
spacedHyphenCount: number;
|
|
473
|
+
emDashSpacingConsistent: boolean;
|
|
474
|
+
dominantEmDashStyle: 'spaced' | 'unspaced' | 'none';
|
|
475
|
+
issues: DashIssue[];
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Scan text for likely dash misuse: a hyphen surrounded by spaces where an
|
|
479
|
+
* em dash is probably intended ("word - word"), a double hyphen ("--")
|
|
480
|
+
* left unconverted from a plain-ASCII source, and inconsistent spacing
|
|
481
|
+
* around em dashes across the same document (mixing "word — word" and
|
|
482
|
+
* "word—word"). Pure regex heuristic over the raw characters; it doesn't
|
|
483
|
+
* parse grammar, so a legitimately hyphenated range or a code sample
|
|
484
|
+
* pasted alongside prose can occasionally be flagged.
|
|
485
|
+
*/
|
|
486
|
+
declare function checkDashUsage(text: string): DashUsageResult;
|
|
459
487
|
|
|
460
488
|
type text_AsciiFont = AsciiFont;
|
|
461
489
|
type text_AsciiOptions = AsciiOptions;
|
|
@@ -463,6 +491,9 @@ declare const text_CASE_FORMATS: typeof CASE_FORMATS;
|
|
|
463
491
|
type text_CaseFormat = CaseFormat;
|
|
464
492
|
type text_ConvertOptions = ConvertOptions;
|
|
465
493
|
declare const text_DEFAULT_CONVERT_OPTIONS: typeof DEFAULT_CONVERT_OPTIONS;
|
|
494
|
+
type text_DashIssue = DashIssue;
|
|
495
|
+
type text_DashIssueType = DashIssueType;
|
|
496
|
+
type text_DashUsageResult = DashUsageResult;
|
|
466
497
|
type text_DiffFile = DiffFile;
|
|
467
498
|
type text_DiffHunk = DiffHunk;
|
|
468
499
|
type text_DiffLine = DiffLine;
|
|
@@ -513,6 +544,7 @@ declare const text_applyOp: typeof applyOp;
|
|
|
513
544
|
declare const text_applyOps: typeof applyOps;
|
|
514
545
|
declare const text_calculateStringDistance: typeof calculateStringDistance;
|
|
515
546
|
declare const text_centerText: typeof centerText;
|
|
547
|
+
declare const text_checkDashUsage: typeof checkDashUsage;
|
|
516
548
|
declare const text_checkOxfordCommaConsistency: typeof checkOxfordCommaConsistency;
|
|
517
549
|
declare const text_convertAll: typeof convertAll;
|
|
518
550
|
declare const text_convertCase: typeof convertCase;
|
|
@@ -568,7 +600,7 @@ declare const text_textToMorse: typeof textToMorse;
|
|
|
568
600
|
declare const text_unescapeString: typeof unescapeString;
|
|
569
601
|
declare const text_wordFrequency: typeof wordFrequency;
|
|
570
602
|
declare namespace text {
|
|
571
|
-
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_OxfordCommaInstance as OxfordCommaInstance, type text_OxfordCommaResult as OxfordCommaResult, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, type text_WordyPhraseMatch as WordyPhraseMatch, type text_WordyPhraseResult as WordyPhraseResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_checkOxfordCommaConsistency as checkOxfordCommaConsistency, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_detectWordyPhrases as detectWordyPhrases, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
603
|
+
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DashIssue as DashIssue, type text_DashIssueType as DashIssueType, type text_DashUsageResult as DashUsageResult, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_OxfordCommaInstance as OxfordCommaInstance, type text_OxfordCommaResult as OxfordCommaResult, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, type text_WordyPhraseMatch as WordyPhraseMatch, type text_WordyPhraseResult as WordyPhraseResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_checkDashUsage as checkDashUsage, text_checkOxfordCommaConsistency as checkOxfordCommaConsistency, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_detectWordyPhrases as detectWordyPhrases, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
572
604
|
}
|
|
573
605
|
|
|
574
|
-
export {
|
|
606
|
+
export { analyzeKeywordDensity as $, type AsciiFont as A, type ParsedTable as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, EMOJI_TABLE as E, type FillerCategory as F, type PassiveVoiceMatch as G, type PassiveVoiceResult as H, type PassiveVoiceSentence as I, type ReadabilityScore as J, type KeywordDensityEntry as K, LINE_OPS as L, MORSE_CODE as M, type SentenceLengthDistribution as N, type OxfordCommaInstance as O, type ParsedDiff as P, type SlugSeparator as Q, type ReadabilityResult as R, type SentenceLengthBucket as S, type StringDistanceMode as T, type StringDistanceResult as U, type TableOptions as V, type TextAnalysis as W, type WordCountResult as X, type WordyPhraseMatch as Y, type WordyPhraseResult as Z, addBorder as _, type AsciiOptions as a, analyzeSentenceLengths as a0, analyzeText as a1, applyOp as a2, applyOps as a3, calculateStringDistance as a4, centerText as a5, checkDashUsage as a6, checkOxfordCommaConsistency as a7, convertAll as a8, convertCase as a9, getMorseForChar as aA, getMorseTiming as aB, htmlToMarkdown as aC, isValidMorse as aD, markdownToHtml as aE, morseToText as aF, numberToOrdinal as aG, numberToRoman as aH, numberToWords as aI, ordinalWords as aJ, parseDiff as aK, parseTableData as aL, readabilityScore as aM, renderMarkdown as aN, romanToNumber as aO, scoreReadability as aP, searchEmoji as aQ, sentenceCount as aR, slugify as aS, slugifyAll as aT, syllableCount as aU, textToAscii as aV, textToMorse as aW, unescapeString as aX, wordFrequency as aY, countWords as aa, csvToHtml as ab, csvToMarkdown as ac, detectDelimiter as ad, detectFillerWords as ae, detectPassiveVoice as af, detectWordyPhrases as ag, diffLines as ah, diffLinesSimple as ai, diffStats as aj, escapeAll as ak, escapeString as al, extractHeadings as am, formatReadingTime as an, generate as ao, generateDiff as ap, generateHtmlTable as aq, generateMarkdownTable as ar, generateParagraphs as as, generateSentences as at, generateWords as au, getAvailableFonts as av, getEmojiByCategory as aw, getEmojiByChar as ax, getEmojiByShortcode as ay, getEmojiCategories as az, type CaseFormat as b, type ConvertOptions as c, type DashIssue as d, type DashIssueType as e, type DashUsageResult as f, type DiffFile as g, type DiffHunk as h, type DiffLine as i, type DiffResult as j, type DiffType as k, type DiffViewerLine as l, ESCAPE_MODES as m, type EmojiEntry as n, type EscapeMode as o, type FillerMatch as p, type FillerWordResult as q, type KeywordDensityOptions as r, type KeywordDensityResult as s, text as t, type LineOp as u, type LineType as v, type LoremUnit as w, type MarkdownResult as x, type MorseOptions as y, type OxfordCommaResult as z };
|
package/dist/tools/code.cjs
CHANGED
|
@@ -4364,6 +4364,71 @@ function extractMarkdownLinkReferences(markdown) {
|
|
|
4364
4364
|
unusedDefinitions
|
|
4365
4365
|
};
|
|
4366
4366
|
}
|
|
4367
|
+
var CHAR_CLASS_SPECIAL_CHARS = /* @__PURE__ */ new Set(["]", "\\", "^", "-"]);
|
|
4368
|
+
function escapeForCharClass(ch) {
|
|
4369
|
+
return CHAR_CLASS_SPECIAL_CHARS.has(ch) ? `\\${ch}` : ch;
|
|
4370
|
+
}
|
|
4371
|
+
var CHAR_CLASS_RANGE_RE = /^(.)-(.)$/u;
|
|
4372
|
+
function buildCharacterClass(options) {
|
|
4373
|
+
const {
|
|
4374
|
+
lowercase = false,
|
|
4375
|
+
uppercase = false,
|
|
4376
|
+
digits = false,
|
|
4377
|
+
whitespace = false,
|
|
4378
|
+
customRanges = [],
|
|
4379
|
+
customChars = "",
|
|
4380
|
+
negate = false
|
|
4381
|
+
} = options ?? {};
|
|
4382
|
+
const hasAny = lowercase || uppercase || digits || whitespace || customRanges.length > 0 || customChars.length > 0;
|
|
4383
|
+
if (!hasAny) {
|
|
4384
|
+
return { error: "At least one character set, custom range, or custom character must be specified" };
|
|
4385
|
+
}
|
|
4386
|
+
const parts = [];
|
|
4387
|
+
const includes = [];
|
|
4388
|
+
if (lowercase) {
|
|
4389
|
+
parts.push("a-z");
|
|
4390
|
+
includes.push("a-z: lowercase letters");
|
|
4391
|
+
}
|
|
4392
|
+
if (uppercase) {
|
|
4393
|
+
parts.push("A-Z");
|
|
4394
|
+
includes.push("A-Z: uppercase letters");
|
|
4395
|
+
}
|
|
4396
|
+
if (digits) {
|
|
4397
|
+
parts.push("0-9");
|
|
4398
|
+
includes.push("0-9: digits");
|
|
4399
|
+
}
|
|
4400
|
+
if (whitespace) {
|
|
4401
|
+
parts.push("\\s");
|
|
4402
|
+
includes.push("\\s: whitespace characters (space, tab, newline, etc.)");
|
|
4403
|
+
}
|
|
4404
|
+
for (let i = 0; i < customRanges.length; i++) {
|
|
4405
|
+
const range = customRanges[i];
|
|
4406
|
+
const match = CHAR_CLASS_RANGE_RE.exec(range);
|
|
4407
|
+
if (!match) {
|
|
4408
|
+
return { error: `customRanges[${i}] ("${range}") must be exactly two characters joined by a hyphen, e.g. "f-k"` };
|
|
4409
|
+
}
|
|
4410
|
+
const [, start, end] = match;
|
|
4411
|
+
if (start.codePointAt(0) > end.codePointAt(0)) {
|
|
4412
|
+
return { error: `customRanges[${i}] ("${range}") has a start character that comes after its end character` };
|
|
4413
|
+
}
|
|
4414
|
+
parts.push(`${escapeForCharClass(start)}-${escapeForCharClass(end)}`);
|
|
4415
|
+
includes.push(`${range}: custom range from '${start}' to '${end}' inclusive`);
|
|
4416
|
+
}
|
|
4417
|
+
if (customChars.length > 0) {
|
|
4418
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4419
|
+
const unique = [];
|
|
4420
|
+
for (const ch of customChars) {
|
|
4421
|
+
if (!seen.has(ch)) {
|
|
4422
|
+
seen.add(ch);
|
|
4423
|
+
unique.push(ch);
|
|
4424
|
+
}
|
|
4425
|
+
}
|
|
4426
|
+
parts.push(unique.map(escapeForCharClass).join(""));
|
|
4427
|
+
includes.push(`custom characters: ${unique.join(", ")}`);
|
|
4428
|
+
}
|
|
4429
|
+
const pattern = `[${negate ? "^" : ""}${parts.join("")}]`;
|
|
4430
|
+
return { pattern, negate, includes };
|
|
4431
|
+
}
|
|
4367
4432
|
|
|
4368
4433
|
exports.ALL_FLAGS = ALL_FLAGS;
|
|
4369
4434
|
exports.CHEATSHEET = CHEATSHEET;
|
|
@@ -4374,6 +4439,7 @@ exports.OPERATIONS = OPERATIONS;
|
|
|
4374
4439
|
exports.SQL_DEFAULT_OPTIONS = SQL_DEFAULT_OPTIONS;
|
|
4375
4440
|
exports.analyzeRegexGroups = analyzeRegexGroups;
|
|
4376
4441
|
exports.auditDependencyRanges = auditDependencyRanges;
|
|
4442
|
+
exports.buildCharacterClass = buildCharacterClass;
|
|
4377
4443
|
exports.buildDockerPull = buildDockerPull;
|
|
4378
4444
|
exports.buildDockerRun = buildDockerRun;
|
|
4379
4445
|
exports.buildGitCommand = buildGitCommand;
|