@utilix-tech/sdk 0.19.0 → 0.20.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 +4 -0
- package/README.md +12 -3
- package/dist/{chunk-F57WMKZO.js → chunk-2I4O5YCT.js} +100 -1
- package/dist/{chunk-3QMUUTBH.js → chunk-Y5OOP6WN.js} +94 -1
- package/dist/index.cjs +192 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{network-DZugNyAQ.d.cts → network-BJOjJnmY.d.cts} +45 -2
- package/dist/{network-DZugNyAQ.d.ts → network-BJOjJnmY.d.ts} +45 -2
- package/dist/{text-Bbx-tZ43.d.cts → text-DS70aMY5.d.cts} +33 -2
- package/dist/{text-Bbx-tZ43.d.ts → text-DS70aMY5.d.ts} +33 -2
- package/dist/tools/network.cjs +93 -0
- package/dist/tools/network.d.cts +1 -1
- package/dist/tools/network.d.ts +1 -1
- package/dist/tools/network.js +1 -1
- package/dist/tools/text.cjs +99 -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/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
|
|
4
4
|
|
|
5
|
+
## 0.20.0
|
|
6
|
+
- Add `buildCacheControl` (cache-control-builder): assemble and explain a `Cache-Control` response header from directives, with warnings for combinations that cancel out.
|
|
7
|
+
- Add `detectFillerWords` (filler-word-detector): scan text for filler words, hedge phrases, and clichés with per-phrase counts and a density score.
|
|
8
|
+
|
|
5
9
|
## 0.19.0
|
|
6
10
|
- Add `detectRedos` (regex-redos-detector): statically flag catastrophic-backtracking risk (nested quantifiers, overlapping alternation, adjacent overlapping quantifiers).
|
|
7
11
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @utilix-tech/sdk
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**556 developer utility functions for Node.js: runs locally, no API key required.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
6
6
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
@@ -132,7 +132,8 @@ generateHtpasswdFile([{ username: "alice", password: "secret" }]);
|
|
|
132
132
|
|
|
133
133
|
```ts
|
|
134
134
|
import { convertCase, slugify, countWords, generateWords, generateParagraphs,
|
|
135
|
-
escapeString, htmlToMarkdown, applyOps, detectPassiveVoice, scoreReadability
|
|
135
|
+
escapeString, htmlToMarkdown, applyOps, detectPassiveVoice, scoreReadability,
|
|
136
|
+
detectFillerWords } from "@utilix-tech/sdk/text";
|
|
136
137
|
|
|
137
138
|
convertCase("hello world", "camelCase"); // "helloWorld"
|
|
138
139
|
convertCase("hello world", "PascalCase"); // "HelloWorld"
|
|
@@ -157,6 +158,10 @@ detectPassiveVoice("The report was reviewed by the committee. They approved it."
|
|
|
157
158
|
// Flesch Reading Ease, Flesch-Kincaid Grade Level, and Gunning Fog Index
|
|
158
159
|
scoreReadability("The cat sat on the mat. It was a sunny day.");
|
|
159
160
|
// { fleschReadingEase: 109, fleschKincaidGrade: -0.6, gunningFog: 2.2, readingLevel: "Very easy (5th grade)", ... }
|
|
161
|
+
|
|
162
|
+
// Flag filler words, hedge phrases, and clichés with counts and density
|
|
163
|
+
detectFillerWords("At the end of the day, I just really think we should circle back.");
|
|
164
|
+
// { totalMatches: 4, fillerCount: 2, clicheCount: 2, density: 28.6, matches: [...] }
|
|
160
165
|
```
|
|
161
166
|
|
|
162
167
|
---
|
|
@@ -315,7 +320,7 @@ calculateTimeValue(1000, 5, 10, "future");
|
|
|
315
320
|
import { getStatusCode, isValidIp, isValidIpv4, isValidIpv6,
|
|
316
321
|
searchStatusCodes, buildGeoUrl, countryCodeToFlag,
|
|
317
322
|
parseHar, validateSitemap, validateRobotsTxt,
|
|
318
|
-
parseUserAgent } from "@utilix-tech/sdk/network";
|
|
323
|
+
parseUserAgent, buildCacheControl } from "@utilix-tech/sdk/network";
|
|
319
324
|
|
|
320
325
|
getStatusCode(404);
|
|
321
326
|
// { code: 404, text: "Not Found", description: "...", category: "Client Error" }
|
|
@@ -345,6 +350,10 @@ validateSitemap('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><ur
|
|
|
345
350
|
// Validate a robots.txt file: User-agent groups, rules, and syntax mistakes
|
|
346
351
|
validateRobotsTxt("User-agent: *\nDisallow: /admin\nSitemap: https://example.com/sitemap.xml");
|
|
347
352
|
// { groups: [...], sitemaps: [...], issues: [...], valid: true }
|
|
353
|
+
|
|
354
|
+
// Build and explain a Cache-Control response header from directives
|
|
355
|
+
buildCacheControl({ visibility: "public", maxAge: 3600, mustRevalidate: true });
|
|
356
|
+
// { header: "public, max-age=3600, must-revalidate", directives: [...], warnings: [] }
|
|
348
357
|
```
|
|
349
358
|
|
|
350
359
|
---
|
|
@@ -20,6 +20,7 @@ __export(text_exports, {
|
|
|
20
20
|
csvToHtml: () => csvToHtml,
|
|
21
21
|
csvToMarkdown: () => csvToMarkdown,
|
|
22
22
|
detectDelimiter: () => detectDelimiter,
|
|
23
|
+
detectFillerWords: () => detectFillerWords,
|
|
23
24
|
detectPassiveVoice: () => detectPassiveVoice,
|
|
24
25
|
diffLines: () => diffLines,
|
|
25
26
|
diffLinesSimple: () => diffLinesSimple,
|
|
@@ -2457,5 +2458,103 @@ function scoreReadability(text) {
|
|
|
2457
2458
|
readingLevel: readabilityGradeLabel(fleschReadingEase)
|
|
2458
2459
|
};
|
|
2459
2460
|
}
|
|
2461
|
+
var FILLER_WORDS = [
|
|
2462
|
+
"very",
|
|
2463
|
+
"really",
|
|
2464
|
+
"just",
|
|
2465
|
+
"actually",
|
|
2466
|
+
"basically",
|
|
2467
|
+
"literally",
|
|
2468
|
+
"simply",
|
|
2469
|
+
"totally",
|
|
2470
|
+
"definitely",
|
|
2471
|
+
"certainly",
|
|
2472
|
+
"essentially",
|
|
2473
|
+
"absolutely",
|
|
2474
|
+
"completely",
|
|
2475
|
+
"extremely",
|
|
2476
|
+
"truly",
|
|
2477
|
+
"honestly",
|
|
2478
|
+
"seriously",
|
|
2479
|
+
"obviously",
|
|
2480
|
+
"clearly",
|
|
2481
|
+
"quite",
|
|
2482
|
+
"rather",
|
|
2483
|
+
"somewhat",
|
|
2484
|
+
"fairly",
|
|
2485
|
+
"virtually"
|
|
2486
|
+
];
|
|
2487
|
+
var HEDGE_PHRASES = [
|
|
2488
|
+
"maybe",
|
|
2489
|
+
"perhaps",
|
|
2490
|
+
"probably",
|
|
2491
|
+
"possibly",
|
|
2492
|
+
"arguably",
|
|
2493
|
+
"kind of",
|
|
2494
|
+
"sort of",
|
|
2495
|
+
"a bit",
|
|
2496
|
+
"a little",
|
|
2497
|
+
"more or less",
|
|
2498
|
+
"in my opinion",
|
|
2499
|
+
"i think",
|
|
2500
|
+
"i believe",
|
|
2501
|
+
"to some extent"
|
|
2502
|
+
];
|
|
2503
|
+
var CLICHE_PHRASES = [
|
|
2504
|
+
"at the end of the day",
|
|
2505
|
+
"think outside the box",
|
|
2506
|
+
"low-hanging fruit",
|
|
2507
|
+
"move the needle",
|
|
2508
|
+
"circle back",
|
|
2509
|
+
"touch base",
|
|
2510
|
+
"on the same page",
|
|
2511
|
+
"hit the ground running",
|
|
2512
|
+
"paradigm shift",
|
|
2513
|
+
"win-win",
|
|
2514
|
+
"game changer",
|
|
2515
|
+
"best of both worlds",
|
|
2516
|
+
"only time will tell",
|
|
2517
|
+
"back to the drawing board",
|
|
2518
|
+
"the tip of the iceberg",
|
|
2519
|
+
"a perfect storm",
|
|
2520
|
+
"needle in a haystack",
|
|
2521
|
+
"raise the bar",
|
|
2522
|
+
"push the envelope",
|
|
2523
|
+
"the elephant in the room",
|
|
2524
|
+
"boil the ocean",
|
|
2525
|
+
"when it rains it pours"
|
|
2526
|
+
];
|
|
2527
|
+
var FILLER_DICTIONARY = [
|
|
2528
|
+
...FILLER_WORDS.map((phrase) => ({ phrase, category: "filler" })),
|
|
2529
|
+
...HEDGE_PHRASES.map((phrase) => ({ phrase, category: "hedge" })),
|
|
2530
|
+
...CLICHE_PHRASES.map((phrase) => ({ phrase, category: "cliche" }))
|
|
2531
|
+
];
|
|
2532
|
+
function _fillerRegex(phrase) {
|
|
2533
|
+
const tokens = phrase.split(/\s+/).map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
2534
|
+
return new RegExp("\\b" + tokens.join("\\s+") + "\\b", "gi");
|
|
2535
|
+
}
|
|
2536
|
+
function detectFillerWords(text) {
|
|
2537
|
+
const totalWords = (text.match(/[A-Za-z0-9']+/g) ?? []).length;
|
|
2538
|
+
const matches = [];
|
|
2539
|
+
for (const entry of FILLER_DICTIONARY) {
|
|
2540
|
+
const re = _fillerRegex(entry.phrase);
|
|
2541
|
+
const indices = [];
|
|
2542
|
+
let m;
|
|
2543
|
+
while ((m = re.exec(text)) !== null) {
|
|
2544
|
+
indices.push(m.index);
|
|
2545
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
2546
|
+
}
|
|
2547
|
+
if (indices.length > 0) {
|
|
2548
|
+
matches.push({ phrase: entry.phrase, category: entry.category, count: indices.length, indices });
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
matches.sort((a, b) => b.count - a.count || a.category.localeCompare(b.category) || a.phrase.localeCompare(b.phrase));
|
|
2552
|
+
const fillerCount = matches.filter((x) => x.category === "filler").reduce((s, x) => s + x.count, 0);
|
|
2553
|
+
const hedgeCount = matches.filter((x) => x.category === "hedge").reduce((s, x) => s + x.count, 0);
|
|
2554
|
+
const clicheCount = matches.filter((x) => x.category === "cliche").reduce((s, x) => s + x.count, 0);
|
|
2555
|
+
const totalMatches = fillerCount + hedgeCount + clicheCount;
|
|
2556
|
+
const density = totalWords > 0 ? Math.round(totalMatches / totalWords * 1e3) / 10 : 0;
|
|
2557
|
+
return { totalWords, totalMatches, fillerCount, hedgeCount, clicheCount, density, matches };
|
|
2558
|
+
}
|
|
2460
2559
|
|
|
2461
|
-
export { CASE_FORMATS, DEFAULT_CONVERT_OPTIONS, ESCAPE_MODES, LINE_OPS, MORSE_CODE, addBorder, analyzeText, applyOp, applyOps, centerText, convertAll, convertCase, countWords, csvToHtml, csvToMarkdown, detectDelimiter, detectPassiveVoice, diffLines, diffLinesSimple, diffStats, escapeAll, escapeString, extractHeadings, formatReadingTime, generate, generateDiff, generateHtmlTable, generateMarkdownTable, generateParagraphs, generateSentences, generateWords, getAvailableFonts, getMorseForChar, getMorseTiming, htmlToMarkdown, isValidMorse, markdownToHtml, morseToText, numberToOrdinal, numberToRoman, numberToWords, ordinalWords, parseDiff, parseTableData, readabilityScore, renderMarkdown, romanToNumber, scoreReadability, sentenceCount, slugify, slugifyAll, syllableCount, textToAscii, textToMorse, text_exports, unescapeString, wordFrequency };
|
|
2560
|
+
export { CASE_FORMATS, DEFAULT_CONVERT_OPTIONS, ESCAPE_MODES, LINE_OPS, MORSE_CODE, addBorder, analyzeText, applyOp, applyOps, centerText, convertAll, convertCase, countWords, csvToHtml, csvToMarkdown, detectDelimiter, detectFillerWords, detectPassiveVoice, diffLines, diffLinesSimple, diffStats, escapeAll, escapeString, extractHeadings, formatReadingTime, generate, generateDiff, generateHtmlTable, generateMarkdownTable, generateParagraphs, generateSentences, generateWords, getAvailableFonts, getMorseForChar, getMorseTiming, htmlToMarkdown, isValidMorse, markdownToHtml, morseToText, numberToOrdinal, numberToRoman, numberToWords, ordinalWords, parseDiff, parseTableData, readabilityScore, renderMarkdown, romanToNumber, scoreReadability, sentenceCount, slugify, slugifyAll, syllableCount, textToAscii, textToMorse, text_exports, unescapeString, wordFrequency };
|
|
@@ -6,6 +6,7 @@ __export(network_exports, {
|
|
|
6
6
|
DNS_RECORD_TYPES: () => DNS_RECORD_TYPES,
|
|
7
7
|
HTTP_HEADERS: () => HTTP_HEADERS,
|
|
8
8
|
STATUS_CODES: () => STATUS_CODES,
|
|
9
|
+
buildCacheControl: () => buildCacheControl,
|
|
9
10
|
buildDnsQueryUrl: () => buildDnsQueryUrl,
|
|
10
11
|
buildGeoUrl: () => buildGeoUrl,
|
|
11
12
|
buildMapUrl: () => buildMapUrl,
|
|
@@ -1721,5 +1722,97 @@ function parseUserAgent(ua) {
|
|
|
1721
1722
|
const device = { type: _detectUaDeviceType(s) };
|
|
1722
1723
|
return { browser, engine, os, device, raw: s };
|
|
1723
1724
|
}
|
|
1725
|
+
var _CACHE_NUM_FIELDS = ["maxAge", "sMaxAge", "staleWhileRevalidate", "staleIfError"];
|
|
1726
|
+
function _humanizeSeconds(s) {
|
|
1727
|
+
if (s === 0) return "0 seconds";
|
|
1728
|
+
const units = [
|
|
1729
|
+
[86400, "day"],
|
|
1730
|
+
[3600, "hour"],
|
|
1731
|
+
[60, "minute"],
|
|
1732
|
+
[1, "second"]
|
|
1733
|
+
];
|
|
1734
|
+
const parts = [];
|
|
1735
|
+
let rem = s;
|
|
1736
|
+
for (const [size, label] of units) {
|
|
1737
|
+
if (rem >= size) {
|
|
1738
|
+
const n = Math.floor(rem / size);
|
|
1739
|
+
rem -= n * size;
|
|
1740
|
+
parts.push(`${n} ${label}${n === 1 ? "" : "s"}`);
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
return parts.slice(0, 2).join(" ");
|
|
1744
|
+
}
|
|
1745
|
+
function buildCacheControl(options = {}) {
|
|
1746
|
+
const nums = {
|
|
1747
|
+
maxAge: null,
|
|
1748
|
+
sMaxAge: null,
|
|
1749
|
+
staleWhileRevalidate: null,
|
|
1750
|
+
staleIfError: null
|
|
1751
|
+
};
|
|
1752
|
+
for (const field of _CACHE_NUM_FIELDS) {
|
|
1753
|
+
const v = options[field];
|
|
1754
|
+
if (v === void 0 || v === null) continue;
|
|
1755
|
+
if (typeof v !== "number" || !Number.isFinite(v) || !Number.isInteger(v) || v < 0) {
|
|
1756
|
+
return { error: `${field} must be a non-negative integer number of seconds` };
|
|
1757
|
+
}
|
|
1758
|
+
nums[field] = v;
|
|
1759
|
+
}
|
|
1760
|
+
const directives = [];
|
|
1761
|
+
const warnings = [];
|
|
1762
|
+
if (options.visibility === "public") {
|
|
1763
|
+
directives.push({ name: "public", value: null, explanation: "Any cache, including shared caches and CDNs, may store this response." });
|
|
1764
|
+
}
|
|
1765
|
+
if (options.visibility === "private") {
|
|
1766
|
+
directives.push({ name: "private", value: null, explanation: "Only the user's browser may cache this response; shared caches and CDNs must not." });
|
|
1767
|
+
}
|
|
1768
|
+
if (options.noCache) {
|
|
1769
|
+
directives.push({ name: "no-cache", value: null, explanation: "A cache may store the response but must revalidate it with the origin before every reuse." });
|
|
1770
|
+
}
|
|
1771
|
+
if (options.noStore) {
|
|
1772
|
+
directives.push({ name: "no-store", value: null, explanation: "No cache may store any part of this request or response." });
|
|
1773
|
+
}
|
|
1774
|
+
if (nums.maxAge !== null) {
|
|
1775
|
+
directives.push({ name: "max-age", value: String(nums.maxAge), explanation: `Considered fresh for ${_humanizeSeconds(nums.maxAge)} (${nums.maxAge}s), after which it becomes stale.` });
|
|
1776
|
+
}
|
|
1777
|
+
if (nums.sMaxAge !== null) {
|
|
1778
|
+
directives.push({ name: "s-maxage", value: String(nums.sMaxAge), explanation: `For shared caches (CDNs, proxies) it is fresh for ${_humanizeSeconds(nums.sMaxAge)} (${nums.sMaxAge}s), overriding max-age there.` });
|
|
1779
|
+
}
|
|
1780
|
+
if (options.mustRevalidate) {
|
|
1781
|
+
directives.push({ name: "must-revalidate", value: null, explanation: "Once stale, a cache must revalidate with the origin and never serve the stale copy." });
|
|
1782
|
+
}
|
|
1783
|
+
if (options.proxyRevalidate) {
|
|
1784
|
+
directives.push({ name: "proxy-revalidate", value: null, explanation: "Like must-revalidate, but the requirement applies only to shared caches." });
|
|
1785
|
+
}
|
|
1786
|
+
if (options.immutable) {
|
|
1787
|
+
directives.push({ name: "immutable", value: null, explanation: "The body will not change while fresh, so browsers should not revalidate it on reload." });
|
|
1788
|
+
}
|
|
1789
|
+
if (options.noTransform) {
|
|
1790
|
+
directives.push({ name: "no-transform", value: null, explanation: "Intermediaries must not modify the response body (for example, recompressing images)." });
|
|
1791
|
+
}
|
|
1792
|
+
if (nums.staleWhileRevalidate !== null) {
|
|
1793
|
+
directives.push({ name: "stale-while-revalidate", value: String(nums.staleWhileRevalidate), explanation: `A cache may serve the stale response for up to ${_humanizeSeconds(nums.staleWhileRevalidate)} (${nums.staleWhileRevalidate}s) while it revalidates in the background.` });
|
|
1794
|
+
}
|
|
1795
|
+
if (nums.staleIfError !== null) {
|
|
1796
|
+
directives.push({ name: "stale-if-error", value: String(nums.staleIfError), explanation: `A cache may serve the stale response for up to ${_humanizeSeconds(nums.staleIfError)} (${nums.staleIfError}s) if the origin returns an error.` });
|
|
1797
|
+
}
|
|
1798
|
+
if (options.mustUnderstand) {
|
|
1799
|
+
directives.push({ name: "must-understand", value: null, explanation: "A cache should store the response only if it understands the caching requirements of the response's status code." });
|
|
1800
|
+
}
|
|
1801
|
+
if (options.noStore && directives.length > 1) {
|
|
1802
|
+
warnings.push("no-store means nothing is cached, so the other directives have no effect.");
|
|
1803
|
+
}
|
|
1804
|
+
if (options.noCache && nums.maxAge !== null) {
|
|
1805
|
+
warnings.push("no-cache forces revalidation on every use, so max-age has little practical effect alongside it.");
|
|
1806
|
+
}
|
|
1807
|
+
if (options.immutable && nums.maxAge === null) {
|
|
1808
|
+
warnings.push("immutable only applies while the response is fresh \u2014 add a max-age so it has a freshness lifetime.");
|
|
1809
|
+
}
|
|
1810
|
+
if (directives.length === 0) {
|
|
1811
|
+
warnings.push("No directives set \u2014 an empty Cache-Control header has no effect.");
|
|
1812
|
+
}
|
|
1813
|
+
const header = directives.map((d) => d.value === null ? d.name : `${d.name}=${d.value}`).join(", ");
|
|
1814
|
+
const snippet = `Cache-Control: ${header}`;
|
|
1815
|
+
return { header, headerName: "Cache-Control", snippet, directives, warnings };
|
|
1816
|
+
}
|
|
1724
1817
|
|
|
1725
|
-
export { DNS_RECORD_TYPES, HTTP_HEADERS, STATUS_CODES, buildDnsQueryUrl, buildGeoUrl, buildMapUrl, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseDnsResponse, parseGeoResponse, parseHar, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap };
|
|
1818
|
+
export { DNS_RECORD_TYPES, HTTP_HEADERS, STATUS_CODES, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildMapUrl, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseDnsResponse, parseGeoResponse, parseHar, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap };
|
package/dist/index.cjs
CHANGED
|
@@ -1874,6 +1874,7 @@ __export(text_exports, {
|
|
|
1874
1874
|
csvToHtml: () => csvToHtml,
|
|
1875
1875
|
csvToMarkdown: () => csvToMarkdown,
|
|
1876
1876
|
detectDelimiter: () => detectDelimiter,
|
|
1877
|
+
detectFillerWords: () => detectFillerWords,
|
|
1877
1878
|
detectPassiveVoice: () => detectPassiveVoice,
|
|
1878
1879
|
diffLines: () => diffLines,
|
|
1879
1880
|
diffLinesSimple: () => diffLinesSimple,
|
|
@@ -4311,6 +4312,104 @@ function scoreReadability(text) {
|
|
|
4311
4312
|
readingLevel: readabilityGradeLabel(fleschReadingEase)
|
|
4312
4313
|
};
|
|
4313
4314
|
}
|
|
4315
|
+
var FILLER_WORDS = [
|
|
4316
|
+
"very",
|
|
4317
|
+
"really",
|
|
4318
|
+
"just",
|
|
4319
|
+
"actually",
|
|
4320
|
+
"basically",
|
|
4321
|
+
"literally",
|
|
4322
|
+
"simply",
|
|
4323
|
+
"totally",
|
|
4324
|
+
"definitely",
|
|
4325
|
+
"certainly",
|
|
4326
|
+
"essentially",
|
|
4327
|
+
"absolutely",
|
|
4328
|
+
"completely",
|
|
4329
|
+
"extremely",
|
|
4330
|
+
"truly",
|
|
4331
|
+
"honestly",
|
|
4332
|
+
"seriously",
|
|
4333
|
+
"obviously",
|
|
4334
|
+
"clearly",
|
|
4335
|
+
"quite",
|
|
4336
|
+
"rather",
|
|
4337
|
+
"somewhat",
|
|
4338
|
+
"fairly",
|
|
4339
|
+
"virtually"
|
|
4340
|
+
];
|
|
4341
|
+
var HEDGE_PHRASES = [
|
|
4342
|
+
"maybe",
|
|
4343
|
+
"perhaps",
|
|
4344
|
+
"probably",
|
|
4345
|
+
"possibly",
|
|
4346
|
+
"arguably",
|
|
4347
|
+
"kind of",
|
|
4348
|
+
"sort of",
|
|
4349
|
+
"a bit",
|
|
4350
|
+
"a little",
|
|
4351
|
+
"more or less",
|
|
4352
|
+
"in my opinion",
|
|
4353
|
+
"i think",
|
|
4354
|
+
"i believe",
|
|
4355
|
+
"to some extent"
|
|
4356
|
+
];
|
|
4357
|
+
var CLICHE_PHRASES = [
|
|
4358
|
+
"at the end of the day",
|
|
4359
|
+
"think outside the box",
|
|
4360
|
+
"low-hanging fruit",
|
|
4361
|
+
"move the needle",
|
|
4362
|
+
"circle back",
|
|
4363
|
+
"touch base",
|
|
4364
|
+
"on the same page",
|
|
4365
|
+
"hit the ground running",
|
|
4366
|
+
"paradigm shift",
|
|
4367
|
+
"win-win",
|
|
4368
|
+
"game changer",
|
|
4369
|
+
"best of both worlds",
|
|
4370
|
+
"only time will tell",
|
|
4371
|
+
"back to the drawing board",
|
|
4372
|
+
"the tip of the iceberg",
|
|
4373
|
+
"a perfect storm",
|
|
4374
|
+
"needle in a haystack",
|
|
4375
|
+
"raise the bar",
|
|
4376
|
+
"push the envelope",
|
|
4377
|
+
"the elephant in the room",
|
|
4378
|
+
"boil the ocean",
|
|
4379
|
+
"when it rains it pours"
|
|
4380
|
+
];
|
|
4381
|
+
var FILLER_DICTIONARY = [
|
|
4382
|
+
...FILLER_WORDS.map((phrase) => ({ phrase, category: "filler" })),
|
|
4383
|
+
...HEDGE_PHRASES.map((phrase) => ({ phrase, category: "hedge" })),
|
|
4384
|
+
...CLICHE_PHRASES.map((phrase) => ({ phrase, category: "cliche" }))
|
|
4385
|
+
];
|
|
4386
|
+
function _fillerRegex(phrase) {
|
|
4387
|
+
const tokens = phrase.split(/\s+/).map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
4388
|
+
return new RegExp("\\b" + tokens.join("\\s+") + "\\b", "gi");
|
|
4389
|
+
}
|
|
4390
|
+
function detectFillerWords(text) {
|
|
4391
|
+
const totalWords = (text.match(/[A-Za-z0-9']+/g) ?? []).length;
|
|
4392
|
+
const matches = [];
|
|
4393
|
+
for (const entry of FILLER_DICTIONARY) {
|
|
4394
|
+
const re = _fillerRegex(entry.phrase);
|
|
4395
|
+
const indices = [];
|
|
4396
|
+
let m;
|
|
4397
|
+
while ((m = re.exec(text)) !== null) {
|
|
4398
|
+
indices.push(m.index);
|
|
4399
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
4400
|
+
}
|
|
4401
|
+
if (indices.length > 0) {
|
|
4402
|
+
matches.push({ phrase: entry.phrase, category: entry.category, count: indices.length, indices });
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
matches.sort((a, b) => b.count - a.count || a.category.localeCompare(b.category) || a.phrase.localeCompare(b.phrase));
|
|
4406
|
+
const fillerCount = matches.filter((x) => x.category === "filler").reduce((s, x) => s + x.count, 0);
|
|
4407
|
+
const hedgeCount = matches.filter((x) => x.category === "hedge").reduce((s, x) => s + x.count, 0);
|
|
4408
|
+
const clicheCount = matches.filter((x) => x.category === "cliche").reduce((s, x) => s + x.count, 0);
|
|
4409
|
+
const totalMatches = fillerCount + hedgeCount + clicheCount;
|
|
4410
|
+
const density = totalWords > 0 ? Math.round(totalMatches / totalWords * 1e3) / 10 : 0;
|
|
4411
|
+
return { totalWords, totalMatches, fillerCount, hedgeCount, clicheCount, density, matches };
|
|
4412
|
+
}
|
|
4314
4413
|
|
|
4315
4414
|
// src/tools/data.ts
|
|
4316
4415
|
var data_exports = {};
|
|
@@ -8009,6 +8108,7 @@ __export(network_exports, {
|
|
|
8009
8108
|
DNS_RECORD_TYPES: () => DNS_RECORD_TYPES,
|
|
8010
8109
|
HTTP_HEADERS: () => HTTP_HEADERS,
|
|
8011
8110
|
STATUS_CODES: () => STATUS_CODES,
|
|
8111
|
+
buildCacheControl: () => buildCacheControl,
|
|
8012
8112
|
buildDnsQueryUrl: () => buildDnsQueryUrl,
|
|
8013
8113
|
buildGeoUrl: () => buildGeoUrl,
|
|
8014
8114
|
buildMapUrl: () => buildMapUrl,
|
|
@@ -9724,6 +9824,98 @@ function parseUserAgent(ua) {
|
|
|
9724
9824
|
const device = { type: _detectUaDeviceType(s) };
|
|
9725
9825
|
return { browser, engine, os, device, raw: s };
|
|
9726
9826
|
}
|
|
9827
|
+
var _CACHE_NUM_FIELDS = ["maxAge", "sMaxAge", "staleWhileRevalidate", "staleIfError"];
|
|
9828
|
+
function _humanizeSeconds(s) {
|
|
9829
|
+
if (s === 0) return "0 seconds";
|
|
9830
|
+
const units = [
|
|
9831
|
+
[86400, "day"],
|
|
9832
|
+
[3600, "hour"],
|
|
9833
|
+
[60, "minute"],
|
|
9834
|
+
[1, "second"]
|
|
9835
|
+
];
|
|
9836
|
+
const parts = [];
|
|
9837
|
+
let rem = s;
|
|
9838
|
+
for (const [size, label] of units) {
|
|
9839
|
+
if (rem >= size) {
|
|
9840
|
+
const n = Math.floor(rem / size);
|
|
9841
|
+
rem -= n * size;
|
|
9842
|
+
parts.push(`${n} ${label}${n === 1 ? "" : "s"}`);
|
|
9843
|
+
}
|
|
9844
|
+
}
|
|
9845
|
+
return parts.slice(0, 2).join(" ");
|
|
9846
|
+
}
|
|
9847
|
+
function buildCacheControl(options = {}) {
|
|
9848
|
+
const nums = {
|
|
9849
|
+
maxAge: null,
|
|
9850
|
+
sMaxAge: null,
|
|
9851
|
+
staleWhileRevalidate: null,
|
|
9852
|
+
staleIfError: null
|
|
9853
|
+
};
|
|
9854
|
+
for (const field of _CACHE_NUM_FIELDS) {
|
|
9855
|
+
const v = options[field];
|
|
9856
|
+
if (v === void 0 || v === null) continue;
|
|
9857
|
+
if (typeof v !== "number" || !Number.isFinite(v) || !Number.isInteger(v) || v < 0) {
|
|
9858
|
+
return { error: `${field} must be a non-negative integer number of seconds` };
|
|
9859
|
+
}
|
|
9860
|
+
nums[field] = v;
|
|
9861
|
+
}
|
|
9862
|
+
const directives = [];
|
|
9863
|
+
const warnings = [];
|
|
9864
|
+
if (options.visibility === "public") {
|
|
9865
|
+
directives.push({ name: "public", value: null, explanation: "Any cache, including shared caches and CDNs, may store this response." });
|
|
9866
|
+
}
|
|
9867
|
+
if (options.visibility === "private") {
|
|
9868
|
+
directives.push({ name: "private", value: null, explanation: "Only the user's browser may cache this response; shared caches and CDNs must not." });
|
|
9869
|
+
}
|
|
9870
|
+
if (options.noCache) {
|
|
9871
|
+
directives.push({ name: "no-cache", value: null, explanation: "A cache may store the response but must revalidate it with the origin before every reuse." });
|
|
9872
|
+
}
|
|
9873
|
+
if (options.noStore) {
|
|
9874
|
+
directives.push({ name: "no-store", value: null, explanation: "No cache may store any part of this request or response." });
|
|
9875
|
+
}
|
|
9876
|
+
if (nums.maxAge !== null) {
|
|
9877
|
+
directives.push({ name: "max-age", value: String(nums.maxAge), explanation: `Considered fresh for ${_humanizeSeconds(nums.maxAge)} (${nums.maxAge}s), after which it becomes stale.` });
|
|
9878
|
+
}
|
|
9879
|
+
if (nums.sMaxAge !== null) {
|
|
9880
|
+
directives.push({ name: "s-maxage", value: String(nums.sMaxAge), explanation: `For shared caches (CDNs, proxies) it is fresh for ${_humanizeSeconds(nums.sMaxAge)} (${nums.sMaxAge}s), overriding max-age there.` });
|
|
9881
|
+
}
|
|
9882
|
+
if (options.mustRevalidate) {
|
|
9883
|
+
directives.push({ name: "must-revalidate", value: null, explanation: "Once stale, a cache must revalidate with the origin and never serve the stale copy." });
|
|
9884
|
+
}
|
|
9885
|
+
if (options.proxyRevalidate) {
|
|
9886
|
+
directives.push({ name: "proxy-revalidate", value: null, explanation: "Like must-revalidate, but the requirement applies only to shared caches." });
|
|
9887
|
+
}
|
|
9888
|
+
if (options.immutable) {
|
|
9889
|
+
directives.push({ name: "immutable", value: null, explanation: "The body will not change while fresh, so browsers should not revalidate it on reload." });
|
|
9890
|
+
}
|
|
9891
|
+
if (options.noTransform) {
|
|
9892
|
+
directives.push({ name: "no-transform", value: null, explanation: "Intermediaries must not modify the response body (for example, recompressing images)." });
|
|
9893
|
+
}
|
|
9894
|
+
if (nums.staleWhileRevalidate !== null) {
|
|
9895
|
+
directives.push({ name: "stale-while-revalidate", value: String(nums.staleWhileRevalidate), explanation: `A cache may serve the stale response for up to ${_humanizeSeconds(nums.staleWhileRevalidate)} (${nums.staleWhileRevalidate}s) while it revalidates in the background.` });
|
|
9896
|
+
}
|
|
9897
|
+
if (nums.staleIfError !== null) {
|
|
9898
|
+
directives.push({ name: "stale-if-error", value: String(nums.staleIfError), explanation: `A cache may serve the stale response for up to ${_humanizeSeconds(nums.staleIfError)} (${nums.staleIfError}s) if the origin returns an error.` });
|
|
9899
|
+
}
|
|
9900
|
+
if (options.mustUnderstand) {
|
|
9901
|
+
directives.push({ name: "must-understand", value: null, explanation: "A cache should store the response only if it understands the caching requirements of the response's status code." });
|
|
9902
|
+
}
|
|
9903
|
+
if (options.noStore && directives.length > 1) {
|
|
9904
|
+
warnings.push("no-store means nothing is cached, so the other directives have no effect.");
|
|
9905
|
+
}
|
|
9906
|
+
if (options.noCache && nums.maxAge !== null) {
|
|
9907
|
+
warnings.push("no-cache forces revalidation on every use, so max-age has little practical effect alongside it.");
|
|
9908
|
+
}
|
|
9909
|
+
if (options.immutable && nums.maxAge === null) {
|
|
9910
|
+
warnings.push("immutable only applies while the response is fresh \u2014 add a max-age so it has a freshness lifetime.");
|
|
9911
|
+
}
|
|
9912
|
+
if (directives.length === 0) {
|
|
9913
|
+
warnings.push("No directives set \u2014 an empty Cache-Control header has no effect.");
|
|
9914
|
+
}
|
|
9915
|
+
const header = directives.map((d) => d.value === null ? d.name : `${d.name}=${d.value}`).join(", ");
|
|
9916
|
+
const snippet = `Cache-Control: ${header}`;
|
|
9917
|
+
return { header, headerName: "Cache-Control", snippet, directives, warnings };
|
|
9918
|
+
}
|
|
9727
9919
|
|
|
9728
9920
|
// src/tools/api.ts
|
|
9729
9921
|
var api_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { j as json } from './json-BjSoIS1h.cjs';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.cjs';
|
|
3
3
|
export { h as hashing } from './hashing-CnetQFD_.cjs';
|
|
4
|
-
export { t as text } from './text-
|
|
4
|
+
export { t as text } from './text-DS70aMY5.cjs';
|
|
5
5
|
export { d as data } from './data-D8XTI7Du.cjs';
|
|
6
6
|
export { g as generators } from './generators-BGtRGpJZ.cjs';
|
|
7
7
|
export { t as time } from './time-DbT8fjaF.cjs';
|
|
8
8
|
export { u as units } from './units-BFTQwpBu.cjs';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-BJOjJnmY.cjs';
|
|
10
10
|
export { a as api } from './api-Xl7OzIgq.cjs';
|
|
11
11
|
export { c as code } from './code-DaRvff2v.cjs';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { j as json } from './json-BjSoIS1h.js';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.js';
|
|
3
3
|
export { h as hashing } from './hashing-CnetQFD_.js';
|
|
4
|
-
export { t as text } from './text-
|
|
4
|
+
export { t as text } from './text-DS70aMY5.js';
|
|
5
5
|
export { d as data } from './data-D8XTI7Du.js';
|
|
6
6
|
export { g as generators } from './generators-BGtRGpJZ.js';
|
|
7
7
|
export { t as time } from './time-DbT8fjaF.js';
|
|
8
8
|
export { u as units } from './units-BFTQwpBu.js';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-BJOjJnmY.js';
|
|
10
10
|
export { a as api } from './api-Xl7OzIgq.js';
|
|
11
11
|
export { c as code } from './code-DaRvff2v.js';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { media_exports as media } from './chunk-XMKJYVKB.js';
|
|
2
2
|
export { units_exports as units } from './chunk-U34B5XPK.js';
|
|
3
|
-
export { network_exports as network } from './chunk-
|
|
3
|
+
export { network_exports as network } from './chunk-Y5OOP6WN.js';
|
|
4
4
|
export { api_exports as api } from './chunk-Q3B3YWOA.js';
|
|
5
5
|
export { code_exports as code } from './chunk-LXKIPPDG.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
@@ -10,7 +10,7 @@ export { ai_agent_exports as ai_agent } from './chunk-265NPGKH.js';
|
|
|
10
10
|
export { json_exports as json } from './chunk-TSAGO3XP.js';
|
|
11
11
|
export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
|
|
12
12
|
export { hashing_exports as hashing } from './chunk-GEFVMGZR.js';
|
|
13
|
-
export { text_exports as text } from './chunk-
|
|
13
|
+
export { text_exports as text } from './chunk-2I4O5YCT.js';
|
|
14
14
|
export { data_exports as data } from './chunk-TINQFTLO.js';
|
|
15
15
|
export { generators_exports as generators } from './chunk-2CJSLYWI.js';
|
|
16
16
|
export { time_exports as time } from './chunk-ZPQZEIXP.js';
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* - sitemap-validator: validateSitemap
|
|
12
12
|
* - robots-txt-validator: validateRobotsTxt
|
|
13
13
|
* - user-agent-parser: parseUserAgent
|
|
14
|
+
* - cache-control-builder: buildCacheControl
|
|
14
15
|
*/
|
|
15
16
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
16
17
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -252,7 +253,48 @@ interface UserAgentInfo {
|
|
|
252
253
|
declare function parseUserAgent(ua: string): UserAgentInfo | {
|
|
253
254
|
error: string;
|
|
254
255
|
};
|
|
256
|
+
interface CacheControlOptions {
|
|
257
|
+
/** `public` (any cache) or `private` (browser only). */
|
|
258
|
+
visibility?: 'public' | 'private' | null;
|
|
259
|
+
noCache?: boolean;
|
|
260
|
+
noStore?: boolean;
|
|
261
|
+
noTransform?: boolean;
|
|
262
|
+
mustRevalidate?: boolean;
|
|
263
|
+
proxyRevalidate?: boolean;
|
|
264
|
+
immutable?: boolean;
|
|
265
|
+
mustUnderstand?: boolean;
|
|
266
|
+
/** Freshness lifetime in seconds. */
|
|
267
|
+
maxAge?: number | null;
|
|
268
|
+
/** Freshness lifetime for shared caches, in seconds. */
|
|
269
|
+
sMaxAge?: number | null;
|
|
270
|
+
staleWhileRevalidate?: number | null;
|
|
271
|
+
staleIfError?: number | null;
|
|
272
|
+
}
|
|
273
|
+
interface CacheControlDirective {
|
|
274
|
+
name: string;
|
|
275
|
+
value: string | null;
|
|
276
|
+
explanation: string;
|
|
277
|
+
}
|
|
278
|
+
interface CacheControlResult {
|
|
279
|
+
header: string;
|
|
280
|
+
headerName: 'Cache-Control';
|
|
281
|
+
snippet: string;
|
|
282
|
+
directives: CacheControlDirective[];
|
|
283
|
+
warnings: string[];
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Build a `Cache-Control` response-header value from a set of directives,
|
|
287
|
+
* with a plain-English explanation of each and warnings for combinations
|
|
288
|
+
* that cancel each other out. Pure string assembly: it never fetches or
|
|
289
|
+
* validates against a live origin.
|
|
290
|
+
*/
|
|
291
|
+
declare function buildCacheControl(options?: CacheControlOptions): CacheControlResult | {
|
|
292
|
+
error: string;
|
|
293
|
+
};
|
|
255
294
|
|
|
295
|
+
type network_CacheControlDirective = CacheControlDirective;
|
|
296
|
+
type network_CacheControlOptions = CacheControlOptions;
|
|
297
|
+
type network_CacheControlResult = CacheControlResult;
|
|
256
298
|
declare const network_DNS_RECORD_TYPES: typeof DNS_RECORD_TYPES;
|
|
257
299
|
type network_DnsRecord = DnsRecord;
|
|
258
300
|
type network_DnsRecordType = DnsRecordType;
|
|
@@ -278,6 +320,7 @@ type network_SitemapValidationResult = SitemapValidationResult;
|
|
|
278
320
|
type network_StatusCode = StatusCode;
|
|
279
321
|
type network_UaDeviceType = UaDeviceType;
|
|
280
322
|
type network_UserAgentInfo = UserAgentInfo;
|
|
323
|
+
declare const network_buildCacheControl: typeof buildCacheControl;
|
|
281
324
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
282
325
|
declare const network_buildGeoUrl: typeof buildGeoUrl;
|
|
283
326
|
declare const network_buildMapUrl: typeof buildMapUrl;
|
|
@@ -309,7 +352,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
|
309
352
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
310
353
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
311
354
|
declare namespace network {
|
|
312
|
-
export { network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
355
|
+
export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
313
356
|
}
|
|
314
357
|
|
|
315
|
-
export {
|
|
358
|
+
export { statusCodeToText as $, formatCoordinates as A, formatTtl as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, getByCategory as E, getHeader as F, type GeoResult as G, HTTP_HEADERS as H, getHeadersByCategory as I, getStatusByCategory as J, getStatusCode as K, isClientError as L, isServerError as M, isSuccess as N, isValidIp as O, type ParsedDnsResult as P, isValidIpv4 as Q, type RobotsGroup as R, STATUS_CODES as S, isValidIpv6 as T, type UaDeviceType as U, parseDnsResponse as V, parseGeoResponse as W, parseHar as X, parseUserAgent as Y, searchHeaders as Z, searchStatusCodes as _, type CacheControlOptions as a, typeNumberToLabel as a0, validateDomain as a1, validateHeaderName as a2, validateHeaderValue as a3, validateRobotsTxt as a4, validateSitemap as a5, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type ParsedGeoResult as k, type RobotsIssue as l, type RobotsRule as m, network as n, type RobotsValidationResult as o, type SitemapIndexEntry as p, type SitemapIssue as q, type SitemapUrlEntry as r, type SitemapValidationResult as s, type StatusCode as t, type UserAgentInfo as u, buildCacheControl as v, buildDnsQueryUrl as w, buildGeoUrl as x, buildMapUrl as y, countryCodeToFlag as z };
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* - sitemap-validator: validateSitemap
|
|
12
12
|
* - robots-txt-validator: validateRobotsTxt
|
|
13
13
|
* - user-agent-parser: parseUserAgent
|
|
14
|
+
* - cache-control-builder: buildCacheControl
|
|
14
15
|
*/
|
|
15
16
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
16
17
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -252,7 +253,48 @@ interface UserAgentInfo {
|
|
|
252
253
|
declare function parseUserAgent(ua: string): UserAgentInfo | {
|
|
253
254
|
error: string;
|
|
254
255
|
};
|
|
256
|
+
interface CacheControlOptions {
|
|
257
|
+
/** `public` (any cache) or `private` (browser only). */
|
|
258
|
+
visibility?: 'public' | 'private' | null;
|
|
259
|
+
noCache?: boolean;
|
|
260
|
+
noStore?: boolean;
|
|
261
|
+
noTransform?: boolean;
|
|
262
|
+
mustRevalidate?: boolean;
|
|
263
|
+
proxyRevalidate?: boolean;
|
|
264
|
+
immutable?: boolean;
|
|
265
|
+
mustUnderstand?: boolean;
|
|
266
|
+
/** Freshness lifetime in seconds. */
|
|
267
|
+
maxAge?: number | null;
|
|
268
|
+
/** Freshness lifetime for shared caches, in seconds. */
|
|
269
|
+
sMaxAge?: number | null;
|
|
270
|
+
staleWhileRevalidate?: number | null;
|
|
271
|
+
staleIfError?: number | null;
|
|
272
|
+
}
|
|
273
|
+
interface CacheControlDirective {
|
|
274
|
+
name: string;
|
|
275
|
+
value: string | null;
|
|
276
|
+
explanation: string;
|
|
277
|
+
}
|
|
278
|
+
interface CacheControlResult {
|
|
279
|
+
header: string;
|
|
280
|
+
headerName: 'Cache-Control';
|
|
281
|
+
snippet: string;
|
|
282
|
+
directives: CacheControlDirective[];
|
|
283
|
+
warnings: string[];
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Build a `Cache-Control` response-header value from a set of directives,
|
|
287
|
+
* with a plain-English explanation of each and warnings for combinations
|
|
288
|
+
* that cancel each other out. Pure string assembly: it never fetches or
|
|
289
|
+
* validates against a live origin.
|
|
290
|
+
*/
|
|
291
|
+
declare function buildCacheControl(options?: CacheControlOptions): CacheControlResult | {
|
|
292
|
+
error: string;
|
|
293
|
+
};
|
|
255
294
|
|
|
295
|
+
type network_CacheControlDirective = CacheControlDirective;
|
|
296
|
+
type network_CacheControlOptions = CacheControlOptions;
|
|
297
|
+
type network_CacheControlResult = CacheControlResult;
|
|
256
298
|
declare const network_DNS_RECORD_TYPES: typeof DNS_RECORD_TYPES;
|
|
257
299
|
type network_DnsRecord = DnsRecord;
|
|
258
300
|
type network_DnsRecordType = DnsRecordType;
|
|
@@ -278,6 +320,7 @@ type network_SitemapValidationResult = SitemapValidationResult;
|
|
|
278
320
|
type network_StatusCode = StatusCode;
|
|
279
321
|
type network_UaDeviceType = UaDeviceType;
|
|
280
322
|
type network_UserAgentInfo = UserAgentInfo;
|
|
323
|
+
declare const network_buildCacheControl: typeof buildCacheControl;
|
|
281
324
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
282
325
|
declare const network_buildGeoUrl: typeof buildGeoUrl;
|
|
283
326
|
declare const network_buildMapUrl: typeof buildMapUrl;
|
|
@@ -309,7 +352,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
|
309
352
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
310
353
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
311
354
|
declare namespace network {
|
|
312
|
-
export { network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
355
|
+
export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
313
356
|
}
|
|
314
357
|
|
|
315
|
-
export {
|
|
358
|
+
export { statusCodeToText as $, formatCoordinates as A, formatTtl as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, getByCategory as E, getHeader as F, type GeoResult as G, HTTP_HEADERS as H, getHeadersByCategory as I, getStatusByCategory as J, getStatusCode as K, isClientError as L, isServerError as M, isSuccess as N, isValidIp as O, type ParsedDnsResult as P, isValidIpv4 as Q, type RobotsGroup as R, STATUS_CODES as S, isValidIpv6 as T, type UaDeviceType as U, parseDnsResponse as V, parseGeoResponse as W, parseHar as X, parseUserAgent as Y, searchHeaders as Z, searchStatusCodes as _, type CacheControlOptions as a, typeNumberToLabel as a0, validateDomain as a1, validateHeaderName as a2, validateHeaderValue as a3, validateRobotsTxt as a4, validateSitemap as a5, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type ParsedGeoResult as k, type RobotsIssue as l, type RobotsRule as m, network as n, type RobotsValidationResult as o, type SitemapIndexEntry as p, type SitemapIssue as q, type SitemapUrlEntry as r, type SitemapValidationResult as s, type StatusCode as t, type UserAgentInfo as u, buildCacheControl as v, buildDnsQueryUrl as w, buildGeoUrl as x, buildMapUrl as y, countryCodeToFlag as z };
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
* - html-table : detectDelimiter, parseTableData, generateHtmlTable, generateMarkdownTable, csvToHtml, csvToMarkdown
|
|
19
19
|
* - ascii-art : textToAscii, getAvailableFonts, addBorder, centerText
|
|
20
20
|
* - morse-code : textToMorse, morseToText, isValidMorse, getMorseForChar, getMorseTiming
|
|
21
|
+
* - passive-voice-detector: detectPassiveVoice
|
|
22
|
+
* - readability-score: scoreReadability
|
|
23
|
+
* - filler-word-detector: detectFillerWords
|
|
21
24
|
*/
|
|
22
25
|
interface WordCountResult {
|
|
23
26
|
words: number;
|
|
@@ -275,6 +278,30 @@ interface ReadabilityResult {
|
|
|
275
278
|
* dictionary lookup, so scores are an estimate rather than exact.
|
|
276
279
|
*/
|
|
277
280
|
declare function scoreReadability(text: string): ReadabilityResult;
|
|
281
|
+
type FillerCategory = 'filler' | 'hedge' | 'cliche';
|
|
282
|
+
interface FillerMatch {
|
|
283
|
+
phrase: string;
|
|
284
|
+
category: FillerCategory;
|
|
285
|
+
count: number;
|
|
286
|
+
indices: number[];
|
|
287
|
+
}
|
|
288
|
+
interface FillerWordResult {
|
|
289
|
+
totalWords: number;
|
|
290
|
+
totalMatches: number;
|
|
291
|
+
fillerCount: number;
|
|
292
|
+
hedgeCount: number;
|
|
293
|
+
clicheCount: number;
|
|
294
|
+
/** Matches per 100 words, to one decimal place. */
|
|
295
|
+
density: number;
|
|
296
|
+
matches: FillerMatch[];
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Scan text for filler words, hedge phrases, and clichés, returning each
|
|
300
|
+
* matched phrase with its category, occurrence count, and character offsets.
|
|
301
|
+
* This is a dictionary-based heuristic: a flagged word (e.g. "just") is a
|
|
302
|
+
* candidate to reconsider, not always wrong in context.
|
|
303
|
+
*/
|
|
304
|
+
declare function detectFillerWords(text: string): FillerWordResult;
|
|
278
305
|
|
|
279
306
|
type text_AsciiFont = AsciiFont;
|
|
280
307
|
type text_AsciiOptions = AsciiOptions;
|
|
@@ -290,6 +317,9 @@ type text_DiffType = DiffType;
|
|
|
290
317
|
type text_DiffViewerLine = DiffViewerLine;
|
|
291
318
|
declare const text_ESCAPE_MODES: typeof ESCAPE_MODES;
|
|
292
319
|
type text_EscapeMode = EscapeMode;
|
|
320
|
+
type text_FillerCategory = FillerCategory;
|
|
321
|
+
type text_FillerMatch = FillerMatch;
|
|
322
|
+
type text_FillerWordResult = FillerWordResult;
|
|
293
323
|
declare const text_LINE_OPS: typeof LINE_OPS;
|
|
294
324
|
type text_LineOp = LineOp;
|
|
295
325
|
type text_LineType = LineType;
|
|
@@ -319,6 +349,7 @@ declare const text_countWords: typeof countWords;
|
|
|
319
349
|
declare const text_csvToHtml: typeof csvToHtml;
|
|
320
350
|
declare const text_csvToMarkdown: typeof csvToMarkdown;
|
|
321
351
|
declare const text_detectDelimiter: typeof detectDelimiter;
|
|
352
|
+
declare const text_detectFillerWords: typeof detectFillerWords;
|
|
322
353
|
declare const text_detectPassiveVoice: typeof detectPassiveVoice;
|
|
323
354
|
declare const text_diffLines: typeof diffLines;
|
|
324
355
|
declare const text_diffLinesSimple: typeof diffLinesSimple;
|
|
@@ -360,7 +391,7 @@ declare const text_textToMorse: typeof textToMorse;
|
|
|
360
391
|
declare const text_unescapeString: typeof unescapeString;
|
|
361
392
|
declare const text_wordFrequency: typeof wordFrequency;
|
|
362
393
|
declare namespace text {
|
|
363
|
-
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_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, 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_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_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, 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_detectPassiveVoice as detectPassiveVoice, 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_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_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 };
|
|
394
|
+
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_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, 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_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_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, 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_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_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_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 };
|
|
364
395
|
}
|
|
365
396
|
|
|
366
|
-
export {
|
|
397
|
+
export { escapeString as $, type AsciiFont as A, applyOp as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, type FillerCategory as F, applyOps as G, centerText as H, convertAll as I, convertCase as J, countWords as K, LINE_OPS as L, MORSE_CODE as M, csvToHtml as N, csvToMarkdown as O, type ParsedDiff as P, detectDelimiter as Q, type ReadabilityResult as R, type SlugSeparator as S, type TableOptions as T, detectFillerWords as U, detectPassiveVoice as V, type WordCountResult as W, diffLines as X, diffLinesSimple as Y, diffStats as Z, escapeAll as _, type AsciiOptions as a, extractHeadings as a0, formatReadingTime as a1, generate as a2, generateDiff as a3, generateHtmlTable as a4, generateMarkdownTable as a5, generateParagraphs as a6, generateSentences as a7, generateWords as a8, getAvailableFonts 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, sentenceCount as aq, slugify as ar, slugifyAll as as, syllableCount as at, textToAscii as au, textToMorse as av, unescapeString as aw, wordFrequency as ax, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, type EscapeMode as j, type FillerMatch as k, type FillerWordResult as l, type LineOp as m, type LineType as n, type LoremUnit as o, type MarkdownResult as p, type MorseOptions as q, type ParsedTable as r, type PassiveVoiceMatch as s, text as t, type PassiveVoiceResult as u, type PassiveVoiceSentence as v, type ReadabilityScore as w, type TextAnalysis as x, addBorder as y, analyzeText as z };
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
* - html-table : detectDelimiter, parseTableData, generateHtmlTable, generateMarkdownTable, csvToHtml, csvToMarkdown
|
|
19
19
|
* - ascii-art : textToAscii, getAvailableFonts, addBorder, centerText
|
|
20
20
|
* - morse-code : textToMorse, morseToText, isValidMorse, getMorseForChar, getMorseTiming
|
|
21
|
+
* - passive-voice-detector: detectPassiveVoice
|
|
22
|
+
* - readability-score: scoreReadability
|
|
23
|
+
* - filler-word-detector: detectFillerWords
|
|
21
24
|
*/
|
|
22
25
|
interface WordCountResult {
|
|
23
26
|
words: number;
|
|
@@ -275,6 +278,30 @@ interface ReadabilityResult {
|
|
|
275
278
|
* dictionary lookup, so scores are an estimate rather than exact.
|
|
276
279
|
*/
|
|
277
280
|
declare function scoreReadability(text: string): ReadabilityResult;
|
|
281
|
+
type FillerCategory = 'filler' | 'hedge' | 'cliche';
|
|
282
|
+
interface FillerMatch {
|
|
283
|
+
phrase: string;
|
|
284
|
+
category: FillerCategory;
|
|
285
|
+
count: number;
|
|
286
|
+
indices: number[];
|
|
287
|
+
}
|
|
288
|
+
interface FillerWordResult {
|
|
289
|
+
totalWords: number;
|
|
290
|
+
totalMatches: number;
|
|
291
|
+
fillerCount: number;
|
|
292
|
+
hedgeCount: number;
|
|
293
|
+
clicheCount: number;
|
|
294
|
+
/** Matches per 100 words, to one decimal place. */
|
|
295
|
+
density: number;
|
|
296
|
+
matches: FillerMatch[];
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Scan text for filler words, hedge phrases, and clichés, returning each
|
|
300
|
+
* matched phrase with its category, occurrence count, and character offsets.
|
|
301
|
+
* This is a dictionary-based heuristic: a flagged word (e.g. "just") is a
|
|
302
|
+
* candidate to reconsider, not always wrong in context.
|
|
303
|
+
*/
|
|
304
|
+
declare function detectFillerWords(text: string): FillerWordResult;
|
|
278
305
|
|
|
279
306
|
type text_AsciiFont = AsciiFont;
|
|
280
307
|
type text_AsciiOptions = AsciiOptions;
|
|
@@ -290,6 +317,9 @@ type text_DiffType = DiffType;
|
|
|
290
317
|
type text_DiffViewerLine = DiffViewerLine;
|
|
291
318
|
declare const text_ESCAPE_MODES: typeof ESCAPE_MODES;
|
|
292
319
|
type text_EscapeMode = EscapeMode;
|
|
320
|
+
type text_FillerCategory = FillerCategory;
|
|
321
|
+
type text_FillerMatch = FillerMatch;
|
|
322
|
+
type text_FillerWordResult = FillerWordResult;
|
|
293
323
|
declare const text_LINE_OPS: typeof LINE_OPS;
|
|
294
324
|
type text_LineOp = LineOp;
|
|
295
325
|
type text_LineType = LineType;
|
|
@@ -319,6 +349,7 @@ declare const text_countWords: typeof countWords;
|
|
|
319
349
|
declare const text_csvToHtml: typeof csvToHtml;
|
|
320
350
|
declare const text_csvToMarkdown: typeof csvToMarkdown;
|
|
321
351
|
declare const text_detectDelimiter: typeof detectDelimiter;
|
|
352
|
+
declare const text_detectFillerWords: typeof detectFillerWords;
|
|
322
353
|
declare const text_detectPassiveVoice: typeof detectPassiveVoice;
|
|
323
354
|
declare const text_diffLines: typeof diffLines;
|
|
324
355
|
declare const text_diffLinesSimple: typeof diffLinesSimple;
|
|
@@ -360,7 +391,7 @@ declare const text_textToMorse: typeof textToMorse;
|
|
|
360
391
|
declare const text_unescapeString: typeof unescapeString;
|
|
361
392
|
declare const text_wordFrequency: typeof wordFrequency;
|
|
362
393
|
declare namespace text {
|
|
363
|
-
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_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, 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_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_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, 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_detectPassiveVoice as detectPassiveVoice, 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_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_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 };
|
|
394
|
+
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_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, 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_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_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, 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_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_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_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 };
|
|
364
395
|
}
|
|
365
396
|
|
|
366
|
-
export {
|
|
397
|
+
export { escapeString as $, type AsciiFont as A, applyOp as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, type FillerCategory as F, applyOps as G, centerText as H, convertAll as I, convertCase as J, countWords as K, LINE_OPS as L, MORSE_CODE as M, csvToHtml as N, csvToMarkdown as O, type ParsedDiff as P, detectDelimiter as Q, type ReadabilityResult as R, type SlugSeparator as S, type TableOptions as T, detectFillerWords as U, detectPassiveVoice as V, type WordCountResult as W, diffLines as X, diffLinesSimple as Y, diffStats as Z, escapeAll as _, type AsciiOptions as a, extractHeadings as a0, formatReadingTime as a1, generate as a2, generateDiff as a3, generateHtmlTable as a4, generateMarkdownTable as a5, generateParagraphs as a6, generateSentences as a7, generateWords as a8, getAvailableFonts 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, sentenceCount as aq, slugify as ar, slugifyAll as as, syllableCount as at, textToAscii as au, textToMorse as av, unescapeString as aw, wordFrequency as ax, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, type EscapeMode as j, type FillerMatch as k, type FillerWordResult as l, type LineOp as m, type LineType as n, type LoremUnit as o, type MarkdownResult as p, type MorseOptions as q, type ParsedTable as r, type PassiveVoiceMatch as s, text as t, type PassiveVoiceResult as u, type PassiveVoiceSentence as v, type ReadabilityScore as w, type TextAnalysis as x, addBorder as y, analyzeText as z };
|
package/dist/tools/network.cjs
CHANGED
|
@@ -1685,10 +1685,103 @@ function parseUserAgent(ua) {
|
|
|
1685
1685
|
const device = { type: _detectUaDeviceType(s) };
|
|
1686
1686
|
return { browser, engine, os, device, raw: s };
|
|
1687
1687
|
}
|
|
1688
|
+
var _CACHE_NUM_FIELDS = ["maxAge", "sMaxAge", "staleWhileRevalidate", "staleIfError"];
|
|
1689
|
+
function _humanizeSeconds(s) {
|
|
1690
|
+
if (s === 0) return "0 seconds";
|
|
1691
|
+
const units = [
|
|
1692
|
+
[86400, "day"],
|
|
1693
|
+
[3600, "hour"],
|
|
1694
|
+
[60, "minute"],
|
|
1695
|
+
[1, "second"]
|
|
1696
|
+
];
|
|
1697
|
+
const parts = [];
|
|
1698
|
+
let rem = s;
|
|
1699
|
+
for (const [size, label] of units) {
|
|
1700
|
+
if (rem >= size) {
|
|
1701
|
+
const n = Math.floor(rem / size);
|
|
1702
|
+
rem -= n * size;
|
|
1703
|
+
parts.push(`${n} ${label}${n === 1 ? "" : "s"}`);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
return parts.slice(0, 2).join(" ");
|
|
1707
|
+
}
|
|
1708
|
+
function buildCacheControl(options = {}) {
|
|
1709
|
+
const nums = {
|
|
1710
|
+
maxAge: null,
|
|
1711
|
+
sMaxAge: null,
|
|
1712
|
+
staleWhileRevalidate: null,
|
|
1713
|
+
staleIfError: null
|
|
1714
|
+
};
|
|
1715
|
+
for (const field of _CACHE_NUM_FIELDS) {
|
|
1716
|
+
const v = options[field];
|
|
1717
|
+
if (v === void 0 || v === null) continue;
|
|
1718
|
+
if (typeof v !== "number" || !Number.isFinite(v) || !Number.isInteger(v) || v < 0) {
|
|
1719
|
+
return { error: `${field} must be a non-negative integer number of seconds` };
|
|
1720
|
+
}
|
|
1721
|
+
nums[field] = v;
|
|
1722
|
+
}
|
|
1723
|
+
const directives = [];
|
|
1724
|
+
const warnings = [];
|
|
1725
|
+
if (options.visibility === "public") {
|
|
1726
|
+
directives.push({ name: "public", value: null, explanation: "Any cache, including shared caches and CDNs, may store this response." });
|
|
1727
|
+
}
|
|
1728
|
+
if (options.visibility === "private") {
|
|
1729
|
+
directives.push({ name: "private", value: null, explanation: "Only the user's browser may cache this response; shared caches and CDNs must not." });
|
|
1730
|
+
}
|
|
1731
|
+
if (options.noCache) {
|
|
1732
|
+
directives.push({ name: "no-cache", value: null, explanation: "A cache may store the response but must revalidate it with the origin before every reuse." });
|
|
1733
|
+
}
|
|
1734
|
+
if (options.noStore) {
|
|
1735
|
+
directives.push({ name: "no-store", value: null, explanation: "No cache may store any part of this request or response." });
|
|
1736
|
+
}
|
|
1737
|
+
if (nums.maxAge !== null) {
|
|
1738
|
+
directives.push({ name: "max-age", value: String(nums.maxAge), explanation: `Considered fresh for ${_humanizeSeconds(nums.maxAge)} (${nums.maxAge}s), after which it becomes stale.` });
|
|
1739
|
+
}
|
|
1740
|
+
if (nums.sMaxAge !== null) {
|
|
1741
|
+
directives.push({ name: "s-maxage", value: String(nums.sMaxAge), explanation: `For shared caches (CDNs, proxies) it is fresh for ${_humanizeSeconds(nums.sMaxAge)} (${nums.sMaxAge}s), overriding max-age there.` });
|
|
1742
|
+
}
|
|
1743
|
+
if (options.mustRevalidate) {
|
|
1744
|
+
directives.push({ name: "must-revalidate", value: null, explanation: "Once stale, a cache must revalidate with the origin and never serve the stale copy." });
|
|
1745
|
+
}
|
|
1746
|
+
if (options.proxyRevalidate) {
|
|
1747
|
+
directives.push({ name: "proxy-revalidate", value: null, explanation: "Like must-revalidate, but the requirement applies only to shared caches." });
|
|
1748
|
+
}
|
|
1749
|
+
if (options.immutable) {
|
|
1750
|
+
directives.push({ name: "immutable", value: null, explanation: "The body will not change while fresh, so browsers should not revalidate it on reload." });
|
|
1751
|
+
}
|
|
1752
|
+
if (options.noTransform) {
|
|
1753
|
+
directives.push({ name: "no-transform", value: null, explanation: "Intermediaries must not modify the response body (for example, recompressing images)." });
|
|
1754
|
+
}
|
|
1755
|
+
if (nums.staleWhileRevalidate !== null) {
|
|
1756
|
+
directives.push({ name: "stale-while-revalidate", value: String(nums.staleWhileRevalidate), explanation: `A cache may serve the stale response for up to ${_humanizeSeconds(nums.staleWhileRevalidate)} (${nums.staleWhileRevalidate}s) while it revalidates in the background.` });
|
|
1757
|
+
}
|
|
1758
|
+
if (nums.staleIfError !== null) {
|
|
1759
|
+
directives.push({ name: "stale-if-error", value: String(nums.staleIfError), explanation: `A cache may serve the stale response for up to ${_humanizeSeconds(nums.staleIfError)} (${nums.staleIfError}s) if the origin returns an error.` });
|
|
1760
|
+
}
|
|
1761
|
+
if (options.mustUnderstand) {
|
|
1762
|
+
directives.push({ name: "must-understand", value: null, explanation: "A cache should store the response only if it understands the caching requirements of the response's status code." });
|
|
1763
|
+
}
|
|
1764
|
+
if (options.noStore && directives.length > 1) {
|
|
1765
|
+
warnings.push("no-store means nothing is cached, so the other directives have no effect.");
|
|
1766
|
+
}
|
|
1767
|
+
if (options.noCache && nums.maxAge !== null) {
|
|
1768
|
+
warnings.push("no-cache forces revalidation on every use, so max-age has little practical effect alongside it.");
|
|
1769
|
+
}
|
|
1770
|
+
if (options.immutable && nums.maxAge === null) {
|
|
1771
|
+
warnings.push("immutable only applies while the response is fresh \u2014 add a max-age so it has a freshness lifetime.");
|
|
1772
|
+
}
|
|
1773
|
+
if (directives.length === 0) {
|
|
1774
|
+
warnings.push("No directives set \u2014 an empty Cache-Control header has no effect.");
|
|
1775
|
+
}
|
|
1776
|
+
const header = directives.map((d) => d.value === null ? d.name : `${d.name}=${d.value}`).join(", ");
|
|
1777
|
+
const snippet = `Cache-Control: ${header}`;
|
|
1778
|
+
return { header, headerName: "Cache-Control", snippet, directives, warnings };
|
|
1779
|
+
}
|
|
1688
1780
|
|
|
1689
1781
|
exports.DNS_RECORD_TYPES = DNS_RECORD_TYPES;
|
|
1690
1782
|
exports.HTTP_HEADERS = HTTP_HEADERS;
|
|
1691
1783
|
exports.STATUS_CODES = STATUS_CODES;
|
|
1784
|
+
exports.buildCacheControl = buildCacheControl;
|
|
1692
1785
|
exports.buildDnsQueryUrl = buildDnsQueryUrl;
|
|
1693
1786
|
exports.buildGeoUrl = buildGeoUrl;
|
|
1694
1787
|
exports.buildMapUrl = buildMapUrl;
|
package/dist/tools/network.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { D as DNS_RECORD_TYPES,
|
|
1
|
+
export { C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, D as DNS_RECORD_TYPES, c as DnsRecord, d as DnsRecordType, e as DnsResponse, G as GeoResult, H as HTTP_HEADERS, f as HarEntry, g as HarParseResult, h as HarSummary, i as HeaderCategory, j as HttpHeader, P as ParsedDnsResult, k as ParsedGeoResult, R as RobotsGroup, l as RobotsIssue, m as RobotsRule, o as RobotsValidationResult, S as STATUS_CODES, p as SitemapIndexEntry, q as SitemapIssue, r as SitemapUrlEntry, s as SitemapValidationResult, t as StatusCode, U as UaDeviceType, u as UserAgentInfo, v as buildCacheControl, w as buildDnsQueryUrl, x as buildGeoUrl, y as buildMapUrl, z as countryCodeToFlag, A as formatCoordinates, B as formatTtl, E as getByCategory, F as getHeader, I as getHeadersByCategory, J as getStatusByCategory, K as getStatusCode, L as isClientError, M as isServerError, N as isSuccess, O as isValidIp, Q as isValidIpv4, T as isValidIpv6, V as parseDnsResponse, W as parseGeoResponse, X as parseHar, Y as parseUserAgent, Z as searchHeaders, _ as searchStatusCodes, $ as statusCodeToText, a0 as typeNumberToLabel, a1 as validateDomain, a2 as validateHeaderName, a3 as validateHeaderValue, a4 as validateRobotsTxt, a5 as validateSitemap } from '../network-BJOjJnmY.cjs';
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { D as DNS_RECORD_TYPES,
|
|
1
|
+
export { C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, D as DNS_RECORD_TYPES, c as DnsRecord, d as DnsRecordType, e as DnsResponse, G as GeoResult, H as HTTP_HEADERS, f as HarEntry, g as HarParseResult, h as HarSummary, i as HeaderCategory, j as HttpHeader, P as ParsedDnsResult, k as ParsedGeoResult, R as RobotsGroup, l as RobotsIssue, m as RobotsRule, o as RobotsValidationResult, S as STATUS_CODES, p as SitemapIndexEntry, q as SitemapIssue, r as SitemapUrlEntry, s as SitemapValidationResult, t as StatusCode, U as UaDeviceType, u as UserAgentInfo, v as buildCacheControl, w as buildDnsQueryUrl, x as buildGeoUrl, y as buildMapUrl, z as countryCodeToFlag, A as formatCoordinates, B as formatTtl, E as getByCategory, F as getHeader, I as getHeadersByCategory, J as getStatusByCategory, K as getStatusCode, L as isClientError, M as isServerError, N as isSuccess, O as isValidIp, Q as isValidIpv4, T as isValidIpv6, V as parseDnsResponse, W as parseGeoResponse, X as parseHar, Y as parseUserAgent, Z as searchHeaders, _ as searchStatusCodes, $ as statusCodeToText, a0 as typeNumberToLabel, a1 as validateDomain, a2 as validateHeaderName, a3 as validateHeaderValue, a4 as validateRobotsTxt, a5 as validateSitemap } from '../network-BJOjJnmY.js';
|
package/dist/tools/network.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DNS_RECORD_TYPES, HTTP_HEADERS, STATUS_CODES, buildDnsQueryUrl, buildGeoUrl, buildMapUrl, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseDnsResponse, parseGeoResponse, parseHar, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap } from '../chunk-
|
|
1
|
+
export { DNS_RECORD_TYPES, HTTP_HEADERS, STATUS_CODES, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildMapUrl, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseDnsResponse, parseGeoResponse, parseHar, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap } from '../chunk-Y5OOP6WN.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/text.cjs
CHANGED
|
@@ -2399,6 +2399,104 @@ function scoreReadability(text) {
|
|
|
2399
2399
|
readingLevel: readabilityGradeLabel(fleschReadingEase)
|
|
2400
2400
|
};
|
|
2401
2401
|
}
|
|
2402
|
+
var FILLER_WORDS = [
|
|
2403
|
+
"very",
|
|
2404
|
+
"really",
|
|
2405
|
+
"just",
|
|
2406
|
+
"actually",
|
|
2407
|
+
"basically",
|
|
2408
|
+
"literally",
|
|
2409
|
+
"simply",
|
|
2410
|
+
"totally",
|
|
2411
|
+
"definitely",
|
|
2412
|
+
"certainly",
|
|
2413
|
+
"essentially",
|
|
2414
|
+
"absolutely",
|
|
2415
|
+
"completely",
|
|
2416
|
+
"extremely",
|
|
2417
|
+
"truly",
|
|
2418
|
+
"honestly",
|
|
2419
|
+
"seriously",
|
|
2420
|
+
"obviously",
|
|
2421
|
+
"clearly",
|
|
2422
|
+
"quite",
|
|
2423
|
+
"rather",
|
|
2424
|
+
"somewhat",
|
|
2425
|
+
"fairly",
|
|
2426
|
+
"virtually"
|
|
2427
|
+
];
|
|
2428
|
+
var HEDGE_PHRASES = [
|
|
2429
|
+
"maybe",
|
|
2430
|
+
"perhaps",
|
|
2431
|
+
"probably",
|
|
2432
|
+
"possibly",
|
|
2433
|
+
"arguably",
|
|
2434
|
+
"kind of",
|
|
2435
|
+
"sort of",
|
|
2436
|
+
"a bit",
|
|
2437
|
+
"a little",
|
|
2438
|
+
"more or less",
|
|
2439
|
+
"in my opinion",
|
|
2440
|
+
"i think",
|
|
2441
|
+
"i believe",
|
|
2442
|
+
"to some extent"
|
|
2443
|
+
];
|
|
2444
|
+
var CLICHE_PHRASES = [
|
|
2445
|
+
"at the end of the day",
|
|
2446
|
+
"think outside the box",
|
|
2447
|
+
"low-hanging fruit",
|
|
2448
|
+
"move the needle",
|
|
2449
|
+
"circle back",
|
|
2450
|
+
"touch base",
|
|
2451
|
+
"on the same page",
|
|
2452
|
+
"hit the ground running",
|
|
2453
|
+
"paradigm shift",
|
|
2454
|
+
"win-win",
|
|
2455
|
+
"game changer",
|
|
2456
|
+
"best of both worlds",
|
|
2457
|
+
"only time will tell",
|
|
2458
|
+
"back to the drawing board",
|
|
2459
|
+
"the tip of the iceberg",
|
|
2460
|
+
"a perfect storm",
|
|
2461
|
+
"needle in a haystack",
|
|
2462
|
+
"raise the bar",
|
|
2463
|
+
"push the envelope",
|
|
2464
|
+
"the elephant in the room",
|
|
2465
|
+
"boil the ocean",
|
|
2466
|
+
"when it rains it pours"
|
|
2467
|
+
];
|
|
2468
|
+
var FILLER_DICTIONARY = [
|
|
2469
|
+
...FILLER_WORDS.map((phrase) => ({ phrase, category: "filler" })),
|
|
2470
|
+
...HEDGE_PHRASES.map((phrase) => ({ phrase, category: "hedge" })),
|
|
2471
|
+
...CLICHE_PHRASES.map((phrase) => ({ phrase, category: "cliche" }))
|
|
2472
|
+
];
|
|
2473
|
+
function _fillerRegex(phrase) {
|
|
2474
|
+
const tokens = phrase.split(/\s+/).map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
2475
|
+
return new RegExp("\\b" + tokens.join("\\s+") + "\\b", "gi");
|
|
2476
|
+
}
|
|
2477
|
+
function detectFillerWords(text) {
|
|
2478
|
+
const totalWords = (text.match(/[A-Za-z0-9']+/g) ?? []).length;
|
|
2479
|
+
const matches = [];
|
|
2480
|
+
for (const entry of FILLER_DICTIONARY) {
|
|
2481
|
+
const re = _fillerRegex(entry.phrase);
|
|
2482
|
+
const indices = [];
|
|
2483
|
+
let m;
|
|
2484
|
+
while ((m = re.exec(text)) !== null) {
|
|
2485
|
+
indices.push(m.index);
|
|
2486
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
2487
|
+
}
|
|
2488
|
+
if (indices.length > 0) {
|
|
2489
|
+
matches.push({ phrase: entry.phrase, category: entry.category, count: indices.length, indices });
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
matches.sort((a, b) => b.count - a.count || a.category.localeCompare(b.category) || a.phrase.localeCompare(b.phrase));
|
|
2493
|
+
const fillerCount = matches.filter((x) => x.category === "filler").reduce((s, x) => s + x.count, 0);
|
|
2494
|
+
const hedgeCount = matches.filter((x) => x.category === "hedge").reduce((s, x) => s + x.count, 0);
|
|
2495
|
+
const clicheCount = matches.filter((x) => x.category === "cliche").reduce((s, x) => s + x.count, 0);
|
|
2496
|
+
const totalMatches = fillerCount + hedgeCount + clicheCount;
|
|
2497
|
+
const density = totalWords > 0 ? Math.round(totalMatches / totalWords * 1e3) / 10 : 0;
|
|
2498
|
+
return { totalWords, totalMatches, fillerCount, hedgeCount, clicheCount, density, matches };
|
|
2499
|
+
}
|
|
2402
2500
|
|
|
2403
2501
|
exports.CASE_FORMATS = CASE_FORMATS;
|
|
2404
2502
|
exports.DEFAULT_CONVERT_OPTIONS = DEFAULT_CONVERT_OPTIONS;
|
|
@@ -2416,6 +2514,7 @@ exports.countWords = countWords;
|
|
|
2416
2514
|
exports.csvToHtml = csvToHtml;
|
|
2417
2515
|
exports.csvToMarkdown = csvToMarkdown;
|
|
2418
2516
|
exports.detectDelimiter = detectDelimiter;
|
|
2517
|
+
exports.detectFillerWords = detectFillerWords;
|
|
2419
2518
|
exports.detectPassiveVoice = detectPassiveVoice;
|
|
2420
2519
|
exports.diffLines = diffLines;
|
|
2421
2520
|
exports.diffLinesSimple = diffLinesSimple;
|
package/dist/tools/text.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AsciiFont, a as AsciiOptions, C as CASE_FORMATS, b as CaseFormat, c as ConvertOptions, D as DEFAULT_CONVERT_OPTIONS, d as DiffFile, e as DiffHunk, f as DiffLine, g as DiffResult, h as DiffType, i as DiffViewerLine, E as ESCAPE_MODES, j as EscapeMode, L as LINE_OPS,
|
|
1
|
+
export { A as AsciiFont, a as AsciiOptions, C as CASE_FORMATS, b as CaseFormat, c as ConvertOptions, D as DEFAULT_CONVERT_OPTIONS, d as DiffFile, e as DiffHunk, f as DiffLine, g as DiffResult, h as DiffType, i as DiffViewerLine, E as ESCAPE_MODES, j as EscapeMode, F as FillerCategory, k as FillerMatch, l as FillerWordResult, L as LINE_OPS, m as LineOp, n as LineType, o as LoremUnit, M as MORSE_CODE, p as MarkdownResult, q as MorseOptions, P as ParsedDiff, r as ParsedTable, s as PassiveVoiceMatch, u as PassiveVoiceResult, v as PassiveVoiceSentence, R as ReadabilityResult, w as ReadabilityScore, S as SlugSeparator, T as TableOptions, x as TextAnalysis, W as WordCountResult, y as addBorder, z as analyzeText, B as applyOp, G as applyOps, H as centerText, I as convertAll, J as convertCase, K as countWords, N as csvToHtml, O as csvToMarkdown, Q as detectDelimiter, U as detectFillerWords, V as detectPassiveVoice, X as diffLines, Y as diffLinesSimple, Z as diffStats, _ as escapeAll, $ as escapeString, a0 as extractHeadings, a1 as formatReadingTime, a2 as generate, a3 as generateDiff, a4 as generateHtmlTable, a5 as generateMarkdownTable, a6 as generateParagraphs, a7 as generateSentences, a8 as generateWords, a9 as getAvailableFonts, aa as getMorseForChar, ab as getMorseTiming, ac as htmlToMarkdown, ad as isValidMorse, ae as markdownToHtml, af as morseToText, ag as numberToOrdinal, ah as numberToRoman, ai as numberToWords, aj as ordinalWords, ak as parseDiff, al as parseTableData, am as readabilityScore, an as renderMarkdown, ao as romanToNumber, ap as scoreReadability, aq as sentenceCount, ar as slugify, as as slugifyAll, at as syllableCount, au as textToAscii, av as textToMorse, aw as unescapeString, ax as wordFrequency } from '../text-DS70aMY5.cjs';
|
package/dist/tools/text.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AsciiFont, a as AsciiOptions, C as CASE_FORMATS, b as CaseFormat, c as ConvertOptions, D as DEFAULT_CONVERT_OPTIONS, d as DiffFile, e as DiffHunk, f as DiffLine, g as DiffResult, h as DiffType, i as DiffViewerLine, E as ESCAPE_MODES, j as EscapeMode, L as LINE_OPS,
|
|
1
|
+
export { A as AsciiFont, a as AsciiOptions, C as CASE_FORMATS, b as CaseFormat, c as ConvertOptions, D as DEFAULT_CONVERT_OPTIONS, d as DiffFile, e as DiffHunk, f as DiffLine, g as DiffResult, h as DiffType, i as DiffViewerLine, E as ESCAPE_MODES, j as EscapeMode, F as FillerCategory, k as FillerMatch, l as FillerWordResult, L as LINE_OPS, m as LineOp, n as LineType, o as LoremUnit, M as MORSE_CODE, p as MarkdownResult, q as MorseOptions, P as ParsedDiff, r as ParsedTable, s as PassiveVoiceMatch, u as PassiveVoiceResult, v as PassiveVoiceSentence, R as ReadabilityResult, w as ReadabilityScore, S as SlugSeparator, T as TableOptions, x as TextAnalysis, W as WordCountResult, y as addBorder, z as analyzeText, B as applyOp, G as applyOps, H as centerText, I as convertAll, J as convertCase, K as countWords, N as csvToHtml, O as csvToMarkdown, Q as detectDelimiter, U as detectFillerWords, V as detectPassiveVoice, X as diffLines, Y as diffLinesSimple, Z as diffStats, _ as escapeAll, $ as escapeString, a0 as extractHeadings, a1 as formatReadingTime, a2 as generate, a3 as generateDiff, a4 as generateHtmlTable, a5 as generateMarkdownTable, a6 as generateParagraphs, a7 as generateSentences, a8 as generateWords, a9 as getAvailableFonts, aa as getMorseForChar, ab as getMorseTiming, ac as htmlToMarkdown, ad as isValidMorse, ae as markdownToHtml, af as morseToText, ag as numberToOrdinal, ah as numberToRoman, ai as numberToWords, aj as ordinalWords, ak as parseDiff, al as parseTableData, am as readabilityScore, an as renderMarkdown, ao as romanToNumber, ap as scoreReadability, aq as sentenceCount, ar as slugify, as as slugifyAll, at as syllableCount, au as textToAscii, av as textToMorse, aw as unescapeString, ax as wordFrequency } from '../text-DS70aMY5.js';
|
package/dist/tools/text.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CASE_FORMATS, DEFAULT_CONVERT_OPTIONS, ESCAPE_MODES, LINE_OPS, MORSE_CODE, addBorder, analyzeText, applyOp, applyOps, centerText, convertAll, convertCase, countWords, csvToHtml, csvToMarkdown, detectDelimiter, detectPassiveVoice, diffLines, diffLinesSimple, diffStats, escapeAll, escapeString, extractHeadings, formatReadingTime, generate, generateDiff, generateHtmlTable, generateMarkdownTable, generateParagraphs, generateSentences, generateWords, getAvailableFonts, getMorseForChar, getMorseTiming, htmlToMarkdown, isValidMorse, markdownToHtml, morseToText, numberToOrdinal, numberToRoman, numberToWords, ordinalWords, parseDiff, parseTableData, readabilityScore, renderMarkdown, romanToNumber, scoreReadability, sentenceCount, slugify, slugifyAll, syllableCount, textToAscii, textToMorse, unescapeString, wordFrequency } from '../chunk-
|
|
1
|
+
export { CASE_FORMATS, DEFAULT_CONVERT_OPTIONS, ESCAPE_MODES, LINE_OPS, MORSE_CODE, addBorder, analyzeText, applyOp, applyOps, centerText, convertAll, convertCase, countWords, csvToHtml, csvToMarkdown, detectDelimiter, detectFillerWords, detectPassiveVoice, diffLines, diffLinesSimple, diffStats, escapeAll, escapeString, extractHeadings, formatReadingTime, generate, generateDiff, generateHtmlTable, generateMarkdownTable, generateParagraphs, generateSentences, generateWords, getAvailableFonts, getMorseForChar, getMorseTiming, htmlToMarkdown, isValidMorse, markdownToHtml, morseToText, numberToOrdinal, numberToRoman, numberToWords, ordinalWords, parseDiff, parseTableData, readabilityScore, renderMarkdown, romanToNumber, scoreReadability, sentenceCount, slugify, slugifyAll, syllableCount, textToAscii, textToMorse, unescapeString, wordFrequency } from '../chunk-2I4O5YCT.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilix-tech/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "154+ developer utility tools for Node.js: JSON, encoding, hashing, color, CSS, network and more. Runs locally, no API key required.",
|
|
5
5
|
"author": "Utilix <hello@utilix.tech>",
|
|
6
6
|
"license": "MIT",
|