cafe-utility 33.9.0 → 33.10.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.
Files changed (3) hide show
  1. package/index.d.ts +2 -0
  2. package/index.js +4 -1
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -468,6 +468,7 @@ declare function makeStorage(numberWithUnit: string, conversionMultiplier?: numb
468
468
  declare function getPreLine(string: string): string
469
469
  declare function getCached<T>(key: string, ttlMillis: number, handler: () => Promise<T>): Promise<T>
470
470
  declare function deleteFromCache(key: string): void
471
+ declare function clearCache(): void
471
472
  declare function deleteExpiredFromCache(): void
472
473
  declare function cacheSize(): number
473
474
  declare function joinUrl(parts: unknown[], relativeToFile?: boolean): string
@@ -1206,6 +1207,7 @@ export declare const Cache: {
1206
1207
  delete: typeof deleteFromCache
1207
1208
  deleteExpired: typeof deleteExpiredFromCache
1208
1209
  size: typeof cacheSize
1210
+ clear: typeof clearCache
1209
1211
  }
1210
1212
  export declare const Vector: {
1211
1213
  addPoint: typeof addPoint
package/index.js CHANGED
@@ -1489,6 +1489,9 @@ async function getCached(n, e, t) {
1489
1489
  function deleteFromCache(n) {
1490
1490
  tinyCache.delete(n)
1491
1491
  }
1492
+ function clearCache() {
1493
+ tinyCache.clear()
1494
+ }
1492
1495
  function deleteExpiredFromCache() {
1493
1496
  const n = Date.now()
1494
1497
  for (const [e, t] of tinyCache.entries()) t.validUntil <= n && tinyCache.delete(e)
@@ -2871,5 +2874,5 @@ class Lock {
2871
2874
  (exports.Types = { isFunction, isObject, isStrictlyObject, isEmptyArray, isEmptyObject, isUndefined, isString, isNumber, isBoolean, isDate, isBlank, isId, isIntegerString, isHexString, isUrl, isBigint, isNullable, asString, asHexString, asSafeString, asIntegerString, asNumber, asFunction, asInteger, asBoolean, asDate, asNullableString, asEmptiableString, asId, asTime, asArray, asObject, asNullableObject, asStringMap, asNumericDictionary, asUrl, asBigint, asEmptiable, asNullable, asOptional, enforceObjectShape, enforceArrayShape, isPng, isJpg, isWebp, isImage }),
2872
2875
  (exports.Strings = { tokenizeByCount, tokenizeByLength, searchHex, searchSubstring, randomHex: randomHexString, randomLetter: randomLetterString, randomAlphanumeric: randomAlphanumericString, randomRichAscii: randomRichAsciiString, randomUnicode: randomUnicodeString, includesAny, slugify, normalForm, enumify, escapeHtml, decodeHtmlEntities, after, afterLast, before, beforeLast, betweenWide, betweenNarrow, getPreLine, containsWord, containsWords, joinUrl, getFuzzyMatchScore, sortByFuzzyScore, splitOnce, splitAll, randomize, expand, shrinkTrim, capitalize, decapitalize, csvEscape, parseCsv, surroundInOut, getExtension, getBasename, normalizeEmail, normalizeFilename, parseFilename, camelToTitle, slugToTitle, slugToCamel, joinHumanly, findWeightedPair, extractBlock, extractAllBlocks, replaceBlocks, indexOfEarliest, lastIndexOfBefore, parseHtmlAttributes, readNextWord, readWordsAfterAll, resolveVariables, resolveVariableWithDefaultSyntax, resolveRemainingVariablesWithDefaults, isLetter, isDigit, isLetterOrDigit, isValidObjectPathCharacter, insert: insertString, indexOfRegex, allIndexOf, lineMatches, linesMatchInOrder, represent, resolveMarkdownLinks, buildUrl, isChinese, replaceBetweenStrings, describeMarkdown, isBalanced, textToFormat, splitFormatting, splitHashtags, splitUrls, route, explodeReplace, generateVariants, replaceWord, replacePascalCaseWords, stripHtml, breakLine, measureTextWidth, toLines, levenshteinDistance, findCommonPrefix, findCommonDirectory }),
2873
2876
  (exports.Assertions = { asEqual, asTrue, asTruthy, asFalse, asFalsy, asEither }),
2874
- (exports.Cache = { get: getCached, delete: deleteFromCache, deleteExpired: deleteExpiredFromCache, size: cacheSize }),
2877
+ (exports.Cache = { get: getCached, delete: deleteFromCache, deleteExpired: deleteExpiredFromCache, size: cacheSize, clear: clearCache }),
2875
2878
  (exports.Vector = { addPoint, subtractPoint, multiplyPoint, normalizePoint, pushPoint, filterCoordinates, findCorners, findLines, raycast, raycastCircle, getLineIntersectionPoint })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-utility",
3
- "version": "33.9.0",
3
+ "version": "33.10.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {