@orama/orama
Advanced tools
Comparing version 1.0.0-beta.8 to 1.0.0-beta.9
const baseId = Date.now().toString().slice(5); | ||
let lastId = 0; | ||
// Checks if `hasOwn` method is defined avoiding errors with older Node.js versions | ||
const hasOwn = Object.hasOwn ?? Object.prototype.hasOwnProperty.call; | ||
const k = 1024; | ||
@@ -11,4 +9,5 @@ const nano = BigInt(1e3); | ||
export function sprintf(template, ...args) { | ||
return template.replaceAll(/%(?:(?<position>\d+)\$)?(?<width>-?\d*\.?\d*)(?<type>[dfs])/g, function(...replaceArgs) { | ||
const { width: rawWidth , type , position } = replaceArgs.at(-1); | ||
return template.replace(/%(?:(?<position>\d+)\$)?(?<width>-?\d*\.?\d*)(?<type>[dfs])/g, function(...replaceArgs) { | ||
const groups = replaceArgs[replaceArgs.length - 1]; | ||
const { width: rawWidth , type , position } = groups; | ||
const replacement = position ? args[Number.parseInt(position) - 1] : args.shift(); | ||
@@ -85,3 +84,7 @@ const width = rawWidth === '' ? 0 : Number.parseInt(rawWidth); | ||
export function getOwnProperty(object, property) { | ||
return hasOwn(object, property) ? object[property] : undefined; | ||
// Checks if `hasOwn` method is defined avoiding errors with older Node.js versions | ||
if (Object.hasOwn === undefined) { | ||
return Object.prototype.hasOwnProperty.call(object, property) ? object[property] : undefined; | ||
} | ||
return Object.hasOwn(object, property) ? object[property] : undefined; | ||
} | ||
@@ -88,0 +91,0 @@ export function getTokenFrequency(token, tokens) { |
@@ -1,2 +0,2 @@ | ||
Copyright 2023 OramaSearch Inc. | ||
Copyright 2023 OramaSearch Inc | ||
@@ -13,2 +13,2 @@ Licensed under the Apache License, Version 2.0 (the "License"); | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
limitations under the License. |
{ | ||
"name": "@orama/orama", | ||
"version": "1.0.0-beta.8", | ||
"version": "1.0.0-beta.9", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Next generation full-text search engine, written in TypeScript", |
Sorry, the diff of this file is not supported yet
1679545
65182