@utilix-tech/sdk 0.5.0 → 0.7.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/README.md +22 -6
- package/dist/{chunk-WWKPLYEP.js → chunk-5CKOJXFU.js} +249 -2
- package/dist/{chunk-YBBYFAOV.js → chunk-F57WMKZO.js} +69 -1
- package/dist/{chunk-FL53T24A.js → chunk-GEFVMGZR.js} +2 -8
- package/dist/index.cjs +318 -9
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/media-D66WnthC.d.cts +107 -0
- package/dist/media-D66WnthC.d.ts +107 -0
- package/dist/{text-CI7JAl7F.d.cts → text-Bbx-tZ43.d.cts} +23 -2
- package/dist/{text-CI7JAl7F.d.ts → text-Bbx-tZ43.d.ts} +23 -2
- package/dist/tools/hashing.cjs +2 -8
- package/dist/tools/hashing.js +1 -1
- package/dist/tools/media.cjs +247 -0
- package/dist/tools/media.d.cts +1 -1
- package/dist/tools/media.d.ts +1 -1
- package/dist/tools/media.js +1 -1
- package/dist/tools/text.cjs +68 -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 +3 -3
- package/dist/media-D-K5aZnq.d.cts +0 -53
- package/dist/media-D-K5aZnq.d.ts +0 -53
|
@@ -256,6 +256,25 @@ interface PassiveVoiceResult {
|
|
|
256
256
|
* "was written", "is being reviewed", "were quickly approved by the team".
|
|
257
257
|
*/
|
|
258
258
|
declare function detectPassiveVoice(text: string): PassiveVoiceResult;
|
|
259
|
+
interface ReadabilityResult {
|
|
260
|
+
wordCount: number;
|
|
261
|
+
sentenceCount: number;
|
|
262
|
+
syllableCount: number;
|
|
263
|
+
complexWordCount: number;
|
|
264
|
+
avgWordsPerSentence: number;
|
|
265
|
+
avgSyllablesPerWord: number;
|
|
266
|
+
fleschReadingEase: number;
|
|
267
|
+
fleschKincaidGrade: number;
|
|
268
|
+
gunningFog: number;
|
|
269
|
+
readingLevel: string;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Score pasted text with Flesch Reading Ease, Flesch-Kincaid Grade Level,
|
|
273
|
+
* and Gunning Fog Index, using a heuristic syllable counter (vowel-group
|
|
274
|
+
* counting with common English spelling adjustments) rather than a
|
|
275
|
+
* dictionary lookup, so scores are an estimate rather than exact.
|
|
276
|
+
*/
|
|
277
|
+
declare function scoreReadability(text: string): ReadabilityResult;
|
|
259
278
|
|
|
260
279
|
type text_AsciiFont = AsciiFont;
|
|
261
280
|
type text_AsciiOptions = AsciiOptions;
|
|
@@ -283,6 +302,7 @@ type text_ParsedTable = ParsedTable;
|
|
|
283
302
|
type text_PassiveVoiceMatch = PassiveVoiceMatch;
|
|
284
303
|
type text_PassiveVoiceResult = PassiveVoiceResult;
|
|
285
304
|
type text_PassiveVoiceSentence = PassiveVoiceSentence;
|
|
305
|
+
type text_ReadabilityResult = ReadabilityResult;
|
|
286
306
|
type text_ReadabilityScore = ReadabilityScore;
|
|
287
307
|
type text_SlugSeparator = SlugSeparator;
|
|
288
308
|
type text_TableOptions = TableOptions;
|
|
@@ -330,6 +350,7 @@ declare const text_parseTableData: typeof parseTableData;
|
|
|
330
350
|
declare const text_readabilityScore: typeof readabilityScore;
|
|
331
351
|
declare const text_renderMarkdown: typeof renderMarkdown;
|
|
332
352
|
declare const text_romanToNumber: typeof romanToNumber;
|
|
353
|
+
declare const text_scoreReadability: typeof scoreReadability;
|
|
333
354
|
declare const text_sentenceCount: typeof sentenceCount;
|
|
334
355
|
declare const text_slugify: typeof slugify;
|
|
335
356
|
declare const text_slugifyAll: typeof slugifyAll;
|
|
@@ -339,7 +360,7 @@ declare const text_textToMorse: typeof textToMorse;
|
|
|
339
360
|
declare const text_unescapeString: typeof unescapeString;
|
|
340
361
|
declare const text_wordFrequency: typeof wordFrequency;
|
|
341
362
|
declare namespace text {
|
|
342
|
-
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_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_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 };
|
|
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 };
|
|
343
364
|
}
|
|
344
365
|
|
|
345
|
-
export {
|
|
366
|
+
export { generateDiff as $, type AsciiFont as A, centerText as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, convertAll as F, convertCase as G, countWords as H, csvToHtml as I, csvToMarkdown as J, detectDelimiter as K, LINE_OPS as L, MORSE_CODE as M, detectPassiveVoice as N, diffLines as O, type ParsedDiff as P, diffLinesSimple as Q, type ReadabilityResult as R, type SlugSeparator as S, type TableOptions as T, diffStats as U, escapeAll as V, type WordCountResult as W, escapeString as X, extractHeadings as Y, formatReadingTime as Z, generate as _, type AsciiOptions as a, generateHtmlTable as a0, generateMarkdownTable as a1, generateParagraphs as a2, generateSentences as a3, generateWords as a4, getAvailableFonts as a5, getMorseForChar as a6, getMorseTiming as a7, htmlToMarkdown as a8, isValidMorse as a9, markdownToHtml as aa, morseToText as ab, numberToOrdinal as ac, numberToRoman as ad, numberToWords as ae, ordinalWords as af, parseDiff as ag, parseTableData as ah, readabilityScore as ai, renderMarkdown as aj, romanToNumber as ak, scoreReadability as al, sentenceCount as am, slugify as an, slugifyAll as ao, syllableCount as ap, textToAscii as aq, textToMorse as ar, unescapeString as as, wordFrequency as at, 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 LineOp as k, type LineType as l, type LoremUnit as m, type MarkdownResult as n, type MorseOptions as o, type ParsedTable as p, type PassiveVoiceMatch as q, type PassiveVoiceResult as r, type PassiveVoiceSentence as s, text as t, type ReadabilityScore as u, type TextAnalysis as v, addBorder as w, analyzeText as x, applyOp as y, applyOps as z };
|
|
@@ -256,6 +256,25 @@ interface PassiveVoiceResult {
|
|
|
256
256
|
* "was written", "is being reviewed", "were quickly approved by the team".
|
|
257
257
|
*/
|
|
258
258
|
declare function detectPassiveVoice(text: string): PassiveVoiceResult;
|
|
259
|
+
interface ReadabilityResult {
|
|
260
|
+
wordCount: number;
|
|
261
|
+
sentenceCount: number;
|
|
262
|
+
syllableCount: number;
|
|
263
|
+
complexWordCount: number;
|
|
264
|
+
avgWordsPerSentence: number;
|
|
265
|
+
avgSyllablesPerWord: number;
|
|
266
|
+
fleschReadingEase: number;
|
|
267
|
+
fleschKincaidGrade: number;
|
|
268
|
+
gunningFog: number;
|
|
269
|
+
readingLevel: string;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Score pasted text with Flesch Reading Ease, Flesch-Kincaid Grade Level,
|
|
273
|
+
* and Gunning Fog Index, using a heuristic syllable counter (vowel-group
|
|
274
|
+
* counting with common English spelling adjustments) rather than a
|
|
275
|
+
* dictionary lookup, so scores are an estimate rather than exact.
|
|
276
|
+
*/
|
|
277
|
+
declare function scoreReadability(text: string): ReadabilityResult;
|
|
259
278
|
|
|
260
279
|
type text_AsciiFont = AsciiFont;
|
|
261
280
|
type text_AsciiOptions = AsciiOptions;
|
|
@@ -283,6 +302,7 @@ type text_ParsedTable = ParsedTable;
|
|
|
283
302
|
type text_PassiveVoiceMatch = PassiveVoiceMatch;
|
|
284
303
|
type text_PassiveVoiceResult = PassiveVoiceResult;
|
|
285
304
|
type text_PassiveVoiceSentence = PassiveVoiceSentence;
|
|
305
|
+
type text_ReadabilityResult = ReadabilityResult;
|
|
286
306
|
type text_ReadabilityScore = ReadabilityScore;
|
|
287
307
|
type text_SlugSeparator = SlugSeparator;
|
|
288
308
|
type text_TableOptions = TableOptions;
|
|
@@ -330,6 +350,7 @@ declare const text_parseTableData: typeof parseTableData;
|
|
|
330
350
|
declare const text_readabilityScore: typeof readabilityScore;
|
|
331
351
|
declare const text_renderMarkdown: typeof renderMarkdown;
|
|
332
352
|
declare const text_romanToNumber: typeof romanToNumber;
|
|
353
|
+
declare const text_scoreReadability: typeof scoreReadability;
|
|
333
354
|
declare const text_sentenceCount: typeof sentenceCount;
|
|
334
355
|
declare const text_slugify: typeof slugify;
|
|
335
356
|
declare const text_slugifyAll: typeof slugifyAll;
|
|
@@ -339,7 +360,7 @@ declare const text_textToMorse: typeof textToMorse;
|
|
|
339
360
|
declare const text_unescapeString: typeof unescapeString;
|
|
340
361
|
declare const text_wordFrequency: typeof wordFrequency;
|
|
341
362
|
declare namespace text {
|
|
342
|
-
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_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_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 };
|
|
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 };
|
|
343
364
|
}
|
|
344
365
|
|
|
345
|
-
export {
|
|
366
|
+
export { generateDiff as $, type AsciiFont as A, centerText as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, convertAll as F, convertCase as G, countWords as H, csvToHtml as I, csvToMarkdown as J, detectDelimiter as K, LINE_OPS as L, MORSE_CODE as M, detectPassiveVoice as N, diffLines as O, type ParsedDiff as P, diffLinesSimple as Q, type ReadabilityResult as R, type SlugSeparator as S, type TableOptions as T, diffStats as U, escapeAll as V, type WordCountResult as W, escapeString as X, extractHeadings as Y, formatReadingTime as Z, generate as _, type AsciiOptions as a, generateHtmlTable as a0, generateMarkdownTable as a1, generateParagraphs as a2, generateSentences as a3, generateWords as a4, getAvailableFonts as a5, getMorseForChar as a6, getMorseTiming as a7, htmlToMarkdown as a8, isValidMorse as a9, markdownToHtml as aa, morseToText as ab, numberToOrdinal as ac, numberToRoman as ad, numberToWords as ae, ordinalWords as af, parseDiff as ag, parseTableData as ah, readabilityScore as ai, renderMarkdown as aj, romanToNumber as ak, scoreReadability as al, sentenceCount as am, slugify as an, slugifyAll as ao, syllableCount as ap, textToAscii as aq, textToMorse as ar, unescapeString as as, wordFrequency as at, 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 LineOp as k, type LineType as l, type LoremUnit as m, type MarkdownResult as n, type MorseOptions as o, type ParsedTable as p, type PassiveVoiceMatch as q, type PassiveVoiceResult as r, type PassiveVoiceSentence as s, text as t, type ReadabilityScore as u, type TextAnalysis as v, addBorder as w, analyzeText as x, applyOp as y, applyOps as z };
|
package/dist/tools/hashing.cjs
CHANGED
|
@@ -175,13 +175,7 @@ function generateMd5Hash(password) {
|
|
|
175
175
|
return "$apr1$" + md5__default.default(password);
|
|
176
176
|
}
|
|
177
177
|
function generateBcryptHash(password, rounds = 10) {
|
|
178
|
-
|
|
179
|
-
let salt = "";
|
|
180
|
-
for (let i = 0; i < 22; i++) salt += chars[Math.floor(Math.random() * chars.length)];
|
|
181
|
-
const roundStr = rounds.toString().padStart(2, "0");
|
|
182
|
-
let hash = "";
|
|
183
|
-
for (let i = 0; i < 31; i++) hash += chars[Math.floor(Math.random() * chars.length)];
|
|
184
|
-
return `$2b$${roundStr}$${salt}${hash}`;
|
|
178
|
+
return bcrypt__default.default.hashSync(password, rounds);
|
|
185
179
|
}
|
|
186
180
|
function generatePlain(password) {
|
|
187
181
|
return password;
|
|
@@ -190,7 +184,7 @@ function createEntry(username, password, algorithm = "bcrypt") {
|
|
|
190
184
|
let hashedPassword;
|
|
191
185
|
switch (algorithm) {
|
|
192
186
|
case "bcrypt":
|
|
193
|
-
hashedPassword = generateBcryptHash();
|
|
187
|
+
hashedPassword = generateBcryptHash(password);
|
|
194
188
|
break;
|
|
195
189
|
case "sha1":
|
|
196
190
|
hashedPassword = generateSha1Hash(password);
|
package/dist/tools/hashing.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { HASH_ALGORITHMS, HASH_BITS, ROUND_OPTIONS, createEntry, generateBcryptHash, generateHtpasswdFile, generateMd5Hash, generatePlain, generateSha1Hash, hashAll, hashOne, hashPassword, hashWithTiming, parseHtpasswdFile, validateRounds, validateUsername, verifyPassword } from '../chunk-
|
|
1
|
+
export { HASH_ALGORITHMS, HASH_BITS, ROUND_OPTIONS, createEntry, generateBcryptHash, generateHtpasswdFile, generateMd5Hash, generatePlain, generateSha1Hash, hashAll, hashOne, hashPassword, hashWithTiming, parseHtpasswdFile, validateRounds, validateUsername, verifyPassword } from '../chunk-GEFVMGZR.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/media.cjs
CHANGED
|
@@ -126,6 +126,195 @@ function readImageInfo(bytes) {
|
|
|
126
126
|
}
|
|
127
127
|
return { error: "Unrecognized image format. Supported formats: PNG, JPEG, GIF, WebP, BMP" };
|
|
128
128
|
}
|
|
129
|
+
var ORIENTATION_LABELS = {
|
|
130
|
+
1: "Normal",
|
|
131
|
+
2: "Mirrored horizontal",
|
|
132
|
+
3: "Rotated 180\xB0",
|
|
133
|
+
4: "Mirrored vertical",
|
|
134
|
+
5: "Mirrored horizontal, rotated 90\xB0 CCW",
|
|
135
|
+
6: "Rotated 90\xB0 CW",
|
|
136
|
+
7: "Mirrored horizontal, rotated 90\xB0 CW",
|
|
137
|
+
8: "Rotated 90\xB0 CCW"
|
|
138
|
+
};
|
|
139
|
+
function tu16(r, o) {
|
|
140
|
+
return r.view.getUint16(o, r.little);
|
|
141
|
+
}
|
|
142
|
+
function tu32(r, o) {
|
|
143
|
+
return r.view.getUint32(o, r.little);
|
|
144
|
+
}
|
|
145
|
+
function readIfdEntries(r, ifdOffset) {
|
|
146
|
+
if (ifdOffset < 0 || ifdOffset + 2 > r.bytes.length) return null;
|
|
147
|
+
const numEntries = tu16(r, ifdOffset);
|
|
148
|
+
const entries = [];
|
|
149
|
+
for (let i = 0; i < numEntries; i++) {
|
|
150
|
+
const entryOffset = ifdOffset + 2 + i * 12;
|
|
151
|
+
if (entryOffset + 12 > r.bytes.length) break;
|
|
152
|
+
entries.push({
|
|
153
|
+
tag: tu16(r, entryOffset),
|
|
154
|
+
type: tu16(r, entryOffset + 2),
|
|
155
|
+
count: tu32(r, entryOffset + 4),
|
|
156
|
+
valueOffsetField: entryOffset + 8
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return { entries };
|
|
160
|
+
}
|
|
161
|
+
function findEntry(entries, tag) {
|
|
162
|
+
return entries.find((e) => e.tag === tag);
|
|
163
|
+
}
|
|
164
|
+
function readAscii(r, entry) {
|
|
165
|
+
const size = entry.count;
|
|
166
|
+
const inline = size <= 4;
|
|
167
|
+
const dataOffset = inline ? entry.valueOffsetField : r.tiffStart + tu32(r, entry.valueOffsetField);
|
|
168
|
+
if (dataOffset < 0 || dataOffset + size > r.bytes.length) return null;
|
|
169
|
+
let out = "";
|
|
170
|
+
for (let i = 0; i < size; i++) {
|
|
171
|
+
const c = r.bytes[dataOffset + i];
|
|
172
|
+
if (c === 0) break;
|
|
173
|
+
out += String.fromCharCode(c);
|
|
174
|
+
}
|
|
175
|
+
const trimmed = out.trim();
|
|
176
|
+
return trimmed || null;
|
|
177
|
+
}
|
|
178
|
+
function readRational(r, entry) {
|
|
179
|
+
const dataOffset = r.tiffStart + tu32(r, entry.valueOffsetField);
|
|
180
|
+
if (dataOffset < 0 || dataOffset + 8 > r.bytes.length) return null;
|
|
181
|
+
return { num: tu32(r, dataOffset), den: tu32(r, dataOffset + 4) };
|
|
182
|
+
}
|
|
183
|
+
function readGpsCoordinate(r, entries, valueTag, refTag) {
|
|
184
|
+
const valueEntry = findEntry(entries, valueTag);
|
|
185
|
+
if (!valueEntry) return null;
|
|
186
|
+
const dataOffset = r.tiffStart + tu32(r, valueEntry.valueOffsetField);
|
|
187
|
+
if (dataOffset < 0 || dataOffset + 24 > r.bytes.length) return null;
|
|
188
|
+
const deg = tu32(r, dataOffset) / (tu32(r, dataOffset + 4) || 1);
|
|
189
|
+
const min = tu32(r, dataOffset + 8) / (tu32(r, dataOffset + 12) || 1);
|
|
190
|
+
const sec = tu32(r, dataOffset + 16) / (tu32(r, dataOffset + 20) || 1);
|
|
191
|
+
let decimal = deg + min / 60 + sec / 3600;
|
|
192
|
+
const refEntry = findEntry(entries, refTag);
|
|
193
|
+
const ref = refEntry ? readAscii(r, refEntry) : null;
|
|
194
|
+
if (ref === "S" || ref === "W") decimal = -decimal;
|
|
195
|
+
return Math.round(decimal * 1e6) / 1e6;
|
|
196
|
+
}
|
|
197
|
+
function gcd(a, b) {
|
|
198
|
+
return b === 0 ? a : gcd(b, a % b);
|
|
199
|
+
}
|
|
200
|
+
function round2(n) {
|
|
201
|
+
return Math.round(n * 100) / 100;
|
|
202
|
+
}
|
|
203
|
+
function formatExposureTime(num, den) {
|
|
204
|
+
if (num === 0) return "0s";
|
|
205
|
+
if (num >= den) return `${round2(num / den)}s`;
|
|
206
|
+
const divisor = gcd(num, den) || 1;
|
|
207
|
+
const n = num / divisor;
|
|
208
|
+
const d = den / divisor;
|
|
209
|
+
return `1/${Math.round(d / n)}`;
|
|
210
|
+
}
|
|
211
|
+
function readExifData(bytes) {
|
|
212
|
+
if (bytes.length < 4 || bytes[0] !== 255 || bytes[1] !== 216) {
|
|
213
|
+
return { error: "Not a JPEG file (EXIF is only read from JPEG files)" };
|
|
214
|
+
}
|
|
215
|
+
let offset = 2;
|
|
216
|
+
let exifStart = -1;
|
|
217
|
+
while (offset + 4 <= bytes.length) {
|
|
218
|
+
if (bytes[offset] !== 255) {
|
|
219
|
+
offset++;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
const marker = bytes[offset + 1];
|
|
223
|
+
if (marker === 216 || marker === 1 || marker >= 208 && marker <= 215) {
|
|
224
|
+
offset += 2;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (marker === 217 || marker === 218) break;
|
|
228
|
+
const segmentLength = bytes[offset + 2] << 8 | bytes[offset + 3];
|
|
229
|
+
if (marker === 225) {
|
|
230
|
+
const idOffset = offset + 4;
|
|
231
|
+
if (idOffset + 6 <= bytes.length && bytes[idOffset] === 69 && bytes[idOffset + 1] === 120 && bytes[idOffset + 2] === 105 && bytes[idOffset + 3] === 102 && bytes[idOffset + 4] === 0 && bytes[idOffset + 5] === 0) {
|
|
232
|
+
exifStart = idOffset + 6;
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
offset += 2 + segmentLength;
|
|
237
|
+
}
|
|
238
|
+
if (exifStart === -1) return { error: "No EXIF segment found in this JPEG" };
|
|
239
|
+
if (exifStart + 8 > bytes.length) return { error: "Truncated EXIF segment" };
|
|
240
|
+
const byteOrder = String.fromCharCode(bytes[exifStart], bytes[exifStart + 1]);
|
|
241
|
+
if (byteOrder !== "II" && byteOrder !== "MM") return { error: "Invalid TIFF byte order marker in EXIF data" };
|
|
242
|
+
const little = byteOrder === "II";
|
|
243
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
244
|
+
const r = { bytes, view, little, tiffStart: exifStart };
|
|
245
|
+
if (tu16(r, exifStart + 2) !== 42) return { error: "Invalid TIFF magic number in EXIF data" };
|
|
246
|
+
const ifd0Offset = exifStart + tu32(r, exifStart + 4);
|
|
247
|
+
const ifd0 = readIfdEntries(r, ifd0Offset);
|
|
248
|
+
if (!ifd0) return { error: "Could not read IFD0 from EXIF data" };
|
|
249
|
+
const result = { tagCount: ifd0.entries.length };
|
|
250
|
+
const makeEntry = findEntry(ifd0.entries, 271);
|
|
251
|
+
if (makeEntry) {
|
|
252
|
+
const v = readAscii(r, makeEntry);
|
|
253
|
+
if (v) result.make = v;
|
|
254
|
+
}
|
|
255
|
+
const modelEntry = findEntry(ifd0.entries, 272);
|
|
256
|
+
if (modelEntry) {
|
|
257
|
+
const v = readAscii(r, modelEntry);
|
|
258
|
+
if (v) result.model = v;
|
|
259
|
+
}
|
|
260
|
+
const softwareEntry = findEntry(ifd0.entries, 305);
|
|
261
|
+
if (softwareEntry) {
|
|
262
|
+
const v = readAscii(r, softwareEntry);
|
|
263
|
+
if (v) result.software = v;
|
|
264
|
+
}
|
|
265
|
+
const dateTimeEntry = findEntry(ifd0.entries, 306);
|
|
266
|
+
if (dateTimeEntry) {
|
|
267
|
+
const v = readAscii(r, dateTimeEntry);
|
|
268
|
+
if (v) result.dateTime = v;
|
|
269
|
+
}
|
|
270
|
+
const orientEntry = findEntry(ifd0.entries, 274);
|
|
271
|
+
if (orientEntry) {
|
|
272
|
+
const v = tu16(r, orientEntry.valueOffsetField);
|
|
273
|
+
result.orientation = v;
|
|
274
|
+
result.orientationLabel = ORIENTATION_LABELS[v] ?? "Unknown";
|
|
275
|
+
}
|
|
276
|
+
const exifIfdPtr = findEntry(ifd0.entries, 34665);
|
|
277
|
+
if (exifIfdPtr) {
|
|
278
|
+
const subOffset = exifStart + tu32(r, exifIfdPtr.valueOffsetField);
|
|
279
|
+
const sub = readIfdEntries(r, subOffset);
|
|
280
|
+
if (sub) {
|
|
281
|
+
const dtoEntry = findEntry(sub.entries, 36867);
|
|
282
|
+
if (dtoEntry) {
|
|
283
|
+
const v = readAscii(r, dtoEntry);
|
|
284
|
+
if (v) result.dateTimeOriginal = v;
|
|
285
|
+
}
|
|
286
|
+
const expEntry = findEntry(sub.entries, 33434);
|
|
287
|
+
if (expEntry) {
|
|
288
|
+
const rat = readRational(r, expEntry);
|
|
289
|
+
if (rat && rat.den !== 0) result.exposureTime = formatExposureTime(rat.num, rat.den);
|
|
290
|
+
}
|
|
291
|
+
const fEntry = findEntry(sub.entries, 33437);
|
|
292
|
+
if (fEntry) {
|
|
293
|
+
const rat = readRational(r, fEntry);
|
|
294
|
+
if (rat && rat.den !== 0) result.fNumber = round2(rat.num / rat.den);
|
|
295
|
+
}
|
|
296
|
+
const isoEntry = findEntry(sub.entries, 34855);
|
|
297
|
+
if (isoEntry) result.isoSpeed = tu16(r, isoEntry.valueOffsetField);
|
|
298
|
+
const focalEntry = findEntry(sub.entries, 37386);
|
|
299
|
+
if (focalEntry) {
|
|
300
|
+
const rat = readRational(r, focalEntry);
|
|
301
|
+
if (rat && rat.den !== 0) result.focalLength = round2(rat.num / rat.den);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const gpsIfdPtr = findEntry(ifd0.entries, 34853);
|
|
306
|
+
if (gpsIfdPtr) {
|
|
307
|
+
const gpsOffset = exifStart + tu32(r, gpsIfdPtr.valueOffsetField);
|
|
308
|
+
const gps = readIfdEntries(r, gpsOffset);
|
|
309
|
+
if (gps) {
|
|
310
|
+
const lat = readGpsCoordinate(r, gps.entries, 2, 1);
|
|
311
|
+
const lon = readGpsCoordinate(r, gps.entries, 4, 3);
|
|
312
|
+
if (lat !== null) result.gpsLatitude = lat;
|
|
313
|
+
if (lon !== null) result.gpsLongitude = lon;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
129
318
|
function bytesToLatin1(bytes) {
|
|
130
319
|
let out = "";
|
|
131
320
|
const CHUNK = 32768;
|
|
@@ -268,6 +457,64 @@ function readPdfMetadata(bytes) {
|
|
|
268
457
|
encrypted
|
|
269
458
|
};
|
|
270
459
|
}
|
|
460
|
+
var AUDIO_FORMAT_LABELS = {
|
|
461
|
+
1: "PCM",
|
|
462
|
+
3: "IEEE float",
|
|
463
|
+
6: "A-law",
|
|
464
|
+
7: "mu-law",
|
|
465
|
+
65534: "Extensible"
|
|
466
|
+
};
|
|
467
|
+
function readAscii4(bytes, offset) {
|
|
468
|
+
return String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);
|
|
469
|
+
}
|
|
470
|
+
function readWavInfo(bytes) {
|
|
471
|
+
if (bytes.length < 12) return { error: "File is too small to be a valid WAV file" };
|
|
472
|
+
if (readAscii4(bytes, 0) !== "RIFF") return { error: 'Not a RIFF file (missing "RIFF" header)' };
|
|
473
|
+
if (readAscii4(bytes, 8) !== "WAVE") return { error: 'Not a WAVE file (missing "WAVE" format marker)' };
|
|
474
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
475
|
+
const fileSize = view.getUint32(4, true) + 8;
|
|
476
|
+
let offset = 12;
|
|
477
|
+
let fmt = null;
|
|
478
|
+
let dataSize = null;
|
|
479
|
+
while (offset + 8 <= bytes.length) {
|
|
480
|
+
const chunkId = readAscii4(bytes, offset);
|
|
481
|
+
const chunkSize = view.getUint32(offset + 4, true);
|
|
482
|
+
const dataOffset = offset + 8;
|
|
483
|
+
if (chunkId === "fmt ") {
|
|
484
|
+
if (dataOffset + 16 > bytes.length) return { error: 'Truncated "fmt " chunk' };
|
|
485
|
+
fmt = {
|
|
486
|
+
audioFormat: view.getUint16(dataOffset, true),
|
|
487
|
+
channels: view.getUint16(dataOffset + 2, true),
|
|
488
|
+
sampleRate: view.getUint32(dataOffset + 4, true),
|
|
489
|
+
byteRate: view.getUint32(dataOffset + 8, true),
|
|
490
|
+
blockAlign: view.getUint16(dataOffset + 12, true),
|
|
491
|
+
bitsPerSample: view.getUint16(dataOffset + 14, true)
|
|
492
|
+
};
|
|
493
|
+
} else if (chunkId === "data") {
|
|
494
|
+
dataSize = Math.min(chunkSize, bytes.length - dataOffset);
|
|
495
|
+
}
|
|
496
|
+
offset = dataOffset + chunkSize + chunkSize % 2;
|
|
497
|
+
if (fmt && dataSize !== null) break;
|
|
498
|
+
}
|
|
499
|
+
if (!fmt) return { error: 'No "fmt " chunk found in this WAV file' };
|
|
500
|
+
if (dataSize === null) return { error: 'No "data" chunk found in this WAV file' };
|
|
501
|
+
if (fmt.byteRate <= 0) return { error: 'Invalid byte rate in "fmt " chunk' };
|
|
502
|
+
const durationSeconds = Math.round(dataSize / fmt.byteRate * 1e3) / 1e3;
|
|
503
|
+
return {
|
|
504
|
+
audioFormat: fmt.audioFormat,
|
|
505
|
+
audioFormatLabel: AUDIO_FORMAT_LABELS[fmt.audioFormat] ?? `Unknown (0x${fmt.audioFormat.toString(16)})`,
|
|
506
|
+
channels: fmt.channels,
|
|
507
|
+
sampleRate: fmt.sampleRate,
|
|
508
|
+
byteRate: fmt.byteRate,
|
|
509
|
+
blockAlign: fmt.blockAlign,
|
|
510
|
+
bitsPerSample: fmt.bitsPerSample,
|
|
511
|
+
dataSize,
|
|
512
|
+
durationSeconds,
|
|
513
|
+
fileSize
|
|
514
|
+
};
|
|
515
|
+
}
|
|
271
516
|
|
|
517
|
+
exports.readExifData = readExifData;
|
|
272
518
|
exports.readImageInfo = readImageInfo;
|
|
273
519
|
exports.readPdfMetadata = readPdfMetadata;
|
|
520
|
+
exports.readWavInfo = readWavInfo;
|
package/dist/tools/media.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { I as ImageFormat,
|
|
1
|
+
export { E as ExifData, a as ExifError, I as ImageFormat, b as ImageInfo, c as ImageInfoError, P as PdfMetadata, d as PdfMetadataError, W as WavInfo, e as WavInfoError, r as readExifData, f as readImageInfo, g as readPdfMetadata, h as readWavInfo } from '../media-D66WnthC.cjs';
|
package/dist/tools/media.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { I as ImageFormat,
|
|
1
|
+
export { E as ExifData, a as ExifError, I as ImageFormat, b as ImageInfo, c as ImageInfoError, P as PdfMetadata, d as PdfMetadataError, W as WavInfo, e as WavInfoError, r as readExifData, f as readImageInfo, g as readPdfMetadata, h as readWavInfo } from '../media-D66WnthC.js';
|
package/dist/tools/media.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { readImageInfo, readPdfMetadata } from '../chunk-
|
|
1
|
+
export { readExifData, readImageInfo, readPdfMetadata, readWavInfo } from '../chunk-5CKOJXFU.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/text.cjs
CHANGED
|
@@ -2332,6 +2332,73 @@ function detectPassiveVoice(text) {
|
|
|
2332
2332
|
const passivePercent = totalSentences > 0 ? Math.round(passiveSentences / totalSentences * 1e3) / 10 : 0;
|
|
2333
2333
|
return { sentences: analyzed, totalSentences, passiveSentences, passivePercent };
|
|
2334
2334
|
}
|
|
2335
|
+
function countSyllables(word) {
|
|
2336
|
+
const w = word.toLowerCase().replace(/[^a-z]/g, "");
|
|
2337
|
+
if (w.length === 0) return 0;
|
|
2338
|
+
if (w.length <= 3) return 1;
|
|
2339
|
+
let count = 0;
|
|
2340
|
+
let prevWasVowel = false;
|
|
2341
|
+
for (const ch of w) {
|
|
2342
|
+
const isVowel = "aeiouy".includes(ch);
|
|
2343
|
+
if (isVowel && !prevWasVowel) count++;
|
|
2344
|
+
prevWasVowel = isVowel;
|
|
2345
|
+
}
|
|
2346
|
+
if (w.endsWith("e") && !w.endsWith("le") && count > 1) count--;
|
|
2347
|
+
if (w.endsWith("le") && w.length > 2 && !"aeiouy".includes(w[w.length - 3])) count++;
|
|
2348
|
+
return Math.max(count, 1);
|
|
2349
|
+
}
|
|
2350
|
+
function readabilityGradeLabel(fleschReadingEase) {
|
|
2351
|
+
if (fleschReadingEase >= 90) return "Very easy (5th grade)";
|
|
2352
|
+
if (fleschReadingEase >= 80) return "Easy (6th grade)";
|
|
2353
|
+
if (fleschReadingEase >= 70) return "Fairly easy (7th grade)";
|
|
2354
|
+
if (fleschReadingEase >= 60) return "Standard (8th-9th grade)";
|
|
2355
|
+
if (fleschReadingEase >= 50) return "Fairly difficult (10th-12th grade)";
|
|
2356
|
+
if (fleschReadingEase >= 30) return "Difficult (college)";
|
|
2357
|
+
return "Very difficult (college graduate)";
|
|
2358
|
+
}
|
|
2359
|
+
function round1(n) {
|
|
2360
|
+
return Math.round(n * 10) / 10;
|
|
2361
|
+
}
|
|
2362
|
+
function scoreReadability(text) {
|
|
2363
|
+
const sentences = splitIntoSentences(text);
|
|
2364
|
+
const words = text.match(/[a-zA-Z']+/g) ?? [];
|
|
2365
|
+
const sentenceCount2 = Math.max(sentences.length, 1);
|
|
2366
|
+
const wordCount = words.length;
|
|
2367
|
+
const syllableCounts = words.map(countSyllables);
|
|
2368
|
+
const syllableCount2 = syllableCounts.reduce((a, b) => a + b, 0);
|
|
2369
|
+
const complexWordCount = syllableCounts.filter((c) => c >= 3).length;
|
|
2370
|
+
if (wordCount === 0) {
|
|
2371
|
+
return {
|
|
2372
|
+
wordCount: 0,
|
|
2373
|
+
sentenceCount: 0,
|
|
2374
|
+
syllableCount: 0,
|
|
2375
|
+
complexWordCount: 0,
|
|
2376
|
+
avgWordsPerSentence: 0,
|
|
2377
|
+
avgSyllablesPerWord: 0,
|
|
2378
|
+
fleschReadingEase: 0,
|
|
2379
|
+
fleschKincaidGrade: 0,
|
|
2380
|
+
gunningFog: 0,
|
|
2381
|
+
readingLevel: "No text to score"
|
|
2382
|
+
};
|
|
2383
|
+
}
|
|
2384
|
+
const avgWordsPerSentence = wordCount / sentenceCount2;
|
|
2385
|
+
const avgSyllablesPerWord = syllableCount2 / wordCount;
|
|
2386
|
+
const fleschReadingEase = round1(206.835 - 1.015 * avgWordsPerSentence - 84.6 * avgSyllablesPerWord);
|
|
2387
|
+
const fleschKincaidGrade = round1(0.39 * avgWordsPerSentence + 11.8 * avgSyllablesPerWord - 15.59);
|
|
2388
|
+
const gunningFog = round1(0.4 * (avgWordsPerSentence + 100 * (complexWordCount / wordCount)));
|
|
2389
|
+
return {
|
|
2390
|
+
wordCount,
|
|
2391
|
+
sentenceCount: sentences.length,
|
|
2392
|
+
syllableCount: syllableCount2,
|
|
2393
|
+
complexWordCount,
|
|
2394
|
+
avgWordsPerSentence: round1(avgWordsPerSentence),
|
|
2395
|
+
avgSyllablesPerWord: round1(avgSyllablesPerWord),
|
|
2396
|
+
fleschReadingEase,
|
|
2397
|
+
fleschKincaidGrade,
|
|
2398
|
+
gunningFog,
|
|
2399
|
+
readingLevel: readabilityGradeLabel(fleschReadingEase)
|
|
2400
|
+
};
|
|
2401
|
+
}
|
|
2335
2402
|
|
|
2336
2403
|
exports.CASE_FORMATS = CASE_FORMATS;
|
|
2337
2404
|
exports.DEFAULT_CONVERT_OPTIONS = DEFAULT_CONVERT_OPTIONS;
|
|
@@ -2380,6 +2447,7 @@ exports.parseTableData = parseTableData;
|
|
|
2380
2447
|
exports.readabilityScore = readabilityScore;
|
|
2381
2448
|
exports.renderMarkdown = renderMarkdown;
|
|
2382
2449
|
exports.romanToNumber = romanToNumber;
|
|
2450
|
+
exports.scoreReadability = scoreReadability;
|
|
2383
2451
|
exports.sentenceCount = sentenceCount;
|
|
2384
2452
|
exports.slugify = slugify;
|
|
2385
2453
|
exports.slugifyAll = slugifyAll;
|
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, k as LineOp, l as LineType, m as LoremUnit, M as MORSE_CODE, n as MarkdownResult, o as MorseOptions, P as ParsedDiff, p as ParsedTable, q as PassiveVoiceMatch, r as PassiveVoiceResult, s as PassiveVoiceSentence, R as ReadabilityScore, S as SlugSeparator, T as TableOptions,
|
|
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, k as LineOp, l as LineType, m as LoremUnit, M as MORSE_CODE, n as MarkdownResult, o as MorseOptions, P as ParsedDiff, p as ParsedTable, q as PassiveVoiceMatch, r as PassiveVoiceResult, s as PassiveVoiceSentence, R as ReadabilityResult, u as ReadabilityScore, S as SlugSeparator, T as TableOptions, v as TextAnalysis, W as WordCountResult, w as addBorder, x as analyzeText, y as applyOp, z as applyOps, B as centerText, F as convertAll, G as convertCase, H as countWords, I as csvToHtml, J as csvToMarkdown, K as detectDelimiter, N as detectPassiveVoice, O as diffLines, Q as diffLinesSimple, U as diffStats, V as escapeAll, X as escapeString, Y as extractHeadings, Z as formatReadingTime, _ as generate, $ as generateDiff, a0 as generateHtmlTable, a1 as generateMarkdownTable, a2 as generateParagraphs, a3 as generateSentences, a4 as generateWords, a5 as getAvailableFonts, a6 as getMorseForChar, a7 as getMorseTiming, a8 as htmlToMarkdown, a9 as isValidMorse, aa as markdownToHtml, ab as morseToText, ac as numberToOrdinal, ad as numberToRoman, ae as numberToWords, af as ordinalWords, ag as parseDiff, ah as parseTableData, ai as readabilityScore, aj as renderMarkdown, ak as romanToNumber, al as scoreReadability, am as sentenceCount, an as slugify, ao as slugifyAll, ap as syllableCount, aq as textToAscii, ar as textToMorse, as as unescapeString, at as wordFrequency } from '../text-Bbx-tZ43.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, k as LineOp, l as LineType, m as LoremUnit, M as MORSE_CODE, n as MarkdownResult, o as MorseOptions, P as ParsedDiff, p as ParsedTable, q as PassiveVoiceMatch, r as PassiveVoiceResult, s as PassiveVoiceSentence, R as ReadabilityScore, S as SlugSeparator, T as TableOptions,
|
|
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, k as LineOp, l as LineType, m as LoremUnit, M as MORSE_CODE, n as MarkdownResult, o as MorseOptions, P as ParsedDiff, p as ParsedTable, q as PassiveVoiceMatch, r as PassiveVoiceResult, s as PassiveVoiceSentence, R as ReadabilityResult, u as ReadabilityScore, S as SlugSeparator, T as TableOptions, v as TextAnalysis, W as WordCountResult, w as addBorder, x as analyzeText, y as applyOp, z as applyOps, B as centerText, F as convertAll, G as convertCase, H as countWords, I as csvToHtml, J as csvToMarkdown, K as detectDelimiter, N as detectPassiveVoice, O as diffLines, Q as diffLinesSimple, U as diffStats, V as escapeAll, X as escapeString, Y as extractHeadings, Z as formatReadingTime, _ as generate, $ as generateDiff, a0 as generateHtmlTable, a1 as generateMarkdownTable, a2 as generateParagraphs, a3 as generateSentences, a4 as generateWords, a5 as getAvailableFonts, a6 as getMorseForChar, a7 as getMorseTiming, a8 as htmlToMarkdown, a9 as isValidMorse, aa as markdownToHtml, ab as morseToText, ac as numberToOrdinal, ad as numberToRoman, ae as numberToWords, af as ordinalWords, ag as parseDiff, ah as parseTableData, ai as readabilityScore, aj as renderMarkdown, ak as romanToNumber, al as scoreReadability, am as sentenceCount, an as slugify, ao as slugifyAll, ap as syllableCount, aq as textToAscii, ar as textToMorse, as as unescapeString, at as wordFrequency } from '../text-Bbx-tZ43.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, 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, 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-F57WMKZO.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.7.0",
|
|
4
4
|
"description": "140+ 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",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"prepublishOnly": "npm run build && npm test"
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|
|
141
|
-
"@types/bcryptjs": "^
|
|
141
|
+
"@types/bcryptjs": "^3.0.0",
|
|
142
142
|
"@types/blueimp-md5": "^2.18.2",
|
|
143
143
|
"@types/js-yaml": "^4.0.9",
|
|
144
144
|
"@types/node": "^20.0.0",
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"vitest": "^2.0.0"
|
|
149
149
|
},
|
|
150
150
|
"dependencies": {
|
|
151
|
-
"bcryptjs": "^
|
|
151
|
+
"bcryptjs": "^3.0.3",
|
|
152
152
|
"blueimp-md5": "^2.19.0",
|
|
153
153
|
"cron-parser": "^4.9.0",
|
|
154
154
|
"date-fns": "^3.6.0",
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
type ImageFormat = 'png' | 'jpeg' | 'gif' | 'webp' | 'bmp';
|
|
2
|
-
interface ImageInfo {
|
|
3
|
-
format: ImageFormat;
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
bitDepth?: number;
|
|
7
|
-
colorType?: string;
|
|
8
|
-
hasAlpha?: boolean;
|
|
9
|
-
}
|
|
10
|
-
interface ImageInfoError {
|
|
11
|
-
error: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Read image format, dimensions, and basic color info straight from file
|
|
15
|
-
* bytes — no decoding, no image library, no canvas. Supports PNG, JPEG,
|
|
16
|
-
* GIF, WebP, and BMP.
|
|
17
|
-
*/
|
|
18
|
-
declare function readImageInfo(bytes: Uint8Array): ImageInfo | ImageInfoError;
|
|
19
|
-
interface PdfMetadata {
|
|
20
|
-
version: string | null;
|
|
21
|
-
pageCount: number | null;
|
|
22
|
-
title: string | null;
|
|
23
|
-
author: string | null;
|
|
24
|
-
subject: string | null;
|
|
25
|
-
keywords: string | null;
|
|
26
|
-
creator: string | null;
|
|
27
|
-
producer: string | null;
|
|
28
|
-
creationDate: string | null;
|
|
29
|
-
modDate: string | null;
|
|
30
|
-
encrypted: boolean;
|
|
31
|
-
}
|
|
32
|
-
interface PdfMetadataError {
|
|
33
|
-
error: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Read PDF metadata (title, author, dates, page count, encryption flag)
|
|
37
|
-
* straight from the file's trailer/Info dictionary and page tree — no
|
|
38
|
-
* pdf.js or other PDF rendering library required.
|
|
39
|
-
*/
|
|
40
|
-
declare function readPdfMetadata(bytes: Uint8Array): PdfMetadata | PdfMetadataError;
|
|
41
|
-
|
|
42
|
-
type media_ImageFormat = ImageFormat;
|
|
43
|
-
type media_ImageInfo = ImageInfo;
|
|
44
|
-
type media_ImageInfoError = ImageInfoError;
|
|
45
|
-
type media_PdfMetadata = PdfMetadata;
|
|
46
|
-
type media_PdfMetadataError = PdfMetadataError;
|
|
47
|
-
declare const media_readImageInfo: typeof readImageInfo;
|
|
48
|
-
declare const media_readPdfMetadata: typeof readPdfMetadata;
|
|
49
|
-
declare namespace media {
|
|
50
|
-
export { type media_ImageFormat as ImageFormat, type media_ImageInfo as ImageInfo, type media_ImageInfoError as ImageInfoError, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, media_readImageInfo as readImageInfo, media_readPdfMetadata as readPdfMetadata };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { type ImageFormat as I, type PdfMetadata as P, type ImageInfo as a, type ImageInfoError as b, type PdfMetadataError as c, readPdfMetadata as d, media as m, readImageInfo as r };
|