kaabalah 1.0.4 → 1.0.5
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/dist/gematria/index.d.mts +5 -2
- package/dist/gematria/index.d.ts +5 -2
- package/dist/gematria/index.js +62 -56
- package/dist/gematria/index.js.map +1 -1
- package/dist/gematria/index.mjs +62 -56
- package/dist/gematria/index.mjs.map +1 -1
- package/dist/index.js +62 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -56
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/gematria/index.mjs
CHANGED
|
@@ -2358,49 +2358,76 @@ var calculateGematria = (word, options = {}, tree) => {
|
|
|
2358
2358
|
tree = createTree({ system: SYSTEM2, parts: [] });
|
|
2359
2359
|
}
|
|
2360
2360
|
const includedLetters = /* @__PURE__ */ new Map();
|
|
2361
|
-
const
|
|
2361
|
+
const words = word.toUpperCase().trim().split(" ");
|
|
2362
2362
|
let vowelsSum = 0;
|
|
2363
2363
|
let consonantsSum = 0;
|
|
2364
2364
|
const presentGematriaNumbers = /* @__PURE__ */ new Set();
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2365
|
+
const letterPercentages = {
|
|
2366
|
+
percentageOfVowels: 0,
|
|
2367
|
+
percentageOfConsonants: 0,
|
|
2368
|
+
letters: {}
|
|
2369
|
+
};
|
|
2370
|
+
for (const word2 of words) {
|
|
2371
|
+
const letters = word2.split("");
|
|
2372
|
+
for (let i = 0; i < letters.length; i++) {
|
|
2373
|
+
const letter = letters[i].toLocaleUpperCase();
|
|
2374
|
+
const nextLetter = letters[i + 1]?.toLocaleLowerCase() || "";
|
|
2375
|
+
if (["P", "T", "K", "S", "C"].includes(letter) && nextLetter) {
|
|
2376
|
+
const combinedLetter = letter + nextLetter;
|
|
2377
|
+
const isEnding2 = i > 0 && i === letters.length - 2;
|
|
2378
|
+
const latinLetterId2 = `letter:${combinedLetter}`;
|
|
2379
|
+
const [mapping2] = tree.walk(latinLetterId2, 2, "hebrewLetter");
|
|
2380
|
+
if (mapping2?.data) {
|
|
2381
|
+
let value = mapping2.data.gematriaValue;
|
|
2382
|
+
if (isEnding2 && mapping2.data.gematriaValueWhenEnding !== void 0) {
|
|
2383
|
+
value = mapping2.data.gematriaValueWhenEnding;
|
|
2384
|
+
}
|
|
2385
|
+
presentGematriaNumbers.add(value);
|
|
2386
|
+
includedLetters.set(latinLetterId2, { letter: combinedLetter, value, hebrewLetter: { id: mapping2.id, data: mapping2.data }, isVowel: isVowel(letter) });
|
|
2387
|
+
consonantsSum += value;
|
|
2388
|
+
i++;
|
|
2389
|
+
continue;
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
let mapping;
|
|
2393
|
+
let latinLetterId = `letter:${letter}`;
|
|
2394
|
+
const isStarting = i === 0;
|
|
2395
|
+
if (isStarting && letter === "O") {
|
|
2396
|
+
latinLetterId = `letter:${HEBREW_LETTERS.AIN}`;
|
|
2397
|
+
mapping = tree.getNode(latinLetterId);
|
|
2398
|
+
} else {
|
|
2399
|
+
mapping = tree.walk(latinLetterId, 2, "hebrewLetter").at(0);
|
|
2400
|
+
}
|
|
2401
|
+
const isEnding = i > 0 && i === letters.length - 1;
|
|
2402
|
+
if (mapping?.data) {
|
|
2403
|
+
let value = mapping.data.gematriaValue;
|
|
2404
|
+
if (isEnding && mapping.data.gematriaValueWhenEnding !== void 0) {
|
|
2405
|
+
value = mapping.data.gematriaValueWhenEnding;
|
|
2376
2406
|
}
|
|
2377
2407
|
presentGematriaNumbers.add(value);
|
|
2378
|
-
includedLetters.set(
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2408
|
+
includedLetters.set(latinLetterId, { letter, value, hebrewLetter: { id: mapping.id, data: mapping.data }, isVowel: isVowel(letter) });
|
|
2409
|
+
if (isVowel(letter)) {
|
|
2410
|
+
vowelsSum += value;
|
|
2411
|
+
} else {
|
|
2412
|
+
consonantsSum += value;
|
|
2413
|
+
}
|
|
2382
2414
|
}
|
|
2383
2415
|
}
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
}
|
|
2397
|
-
presentGematriaNumbers.add(value);
|
|
2398
|
-
includedLetters.set(mapping.id, { letter, value, hebrewLetter: mapping.data, isVowel: isVowel(letter) });
|
|
2399
|
-
if (isVowel(letter)) {
|
|
2400
|
-
vowelsSum += value;
|
|
2401
|
-
} else {
|
|
2402
|
-
consonantsSum += value;
|
|
2416
|
+
if (options?.calculateLetterPercentage) {
|
|
2417
|
+
const letterCount = letters.length;
|
|
2418
|
+
let vowelsCount = 0;
|
|
2419
|
+
let consonantsCount = 0;
|
|
2420
|
+
for (const letter of new Set(letters)) {
|
|
2421
|
+
const occurrences = letters.filter((l) => l === letter).length;
|
|
2422
|
+
letterPercentages.letters[letter] = occurrences / letterCount * 100;
|
|
2423
|
+
if (isVowel(letter)) {
|
|
2424
|
+
vowelsCount += occurrences;
|
|
2425
|
+
} else {
|
|
2426
|
+
consonantsCount += occurrences;
|
|
2427
|
+
}
|
|
2403
2428
|
}
|
|
2429
|
+
letterPercentages.percentageOfVowels = vowelsCount / letterCount * 100;
|
|
2430
|
+
letterPercentages.percentageOfConsonants = consonantsCount / letterCount * 100;
|
|
2404
2431
|
}
|
|
2405
2432
|
}
|
|
2406
2433
|
const vowelsReduction = reduceToSingleDigitWithSteps(vowelsSum);
|
|
@@ -2430,27 +2457,6 @@ var calculateGematria = (word, options = {}, tree) => {
|
|
|
2430
2457
|
}
|
|
2431
2458
|
missingGematriaNumbers.sort((a, b) => a.number - b.number);
|
|
2432
2459
|
}
|
|
2433
|
-
const letterPercentages = {
|
|
2434
|
-
percentageOfVowels: 0,
|
|
2435
|
-
percentageOfConsonants: 0,
|
|
2436
|
-
letters: {}
|
|
2437
|
-
};
|
|
2438
|
-
if (options?.calculateLetterPercentage) {
|
|
2439
|
-
const letterCount = letters.length;
|
|
2440
|
-
let vowelsCount = 0;
|
|
2441
|
-
let consonantsCount = 0;
|
|
2442
|
-
for (const [_, letter] of includedLetters) {
|
|
2443
|
-
const occurrences = letters.filter((l) => l === letter.letter).length;
|
|
2444
|
-
letterPercentages.letters[letter.letter] = occurrences / letterCount * 100;
|
|
2445
|
-
if (letter.isVowel) {
|
|
2446
|
-
vowelsCount += occurrences;
|
|
2447
|
-
} else {
|
|
2448
|
-
consonantsCount += occurrences;
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
letterPercentages.percentageOfVowels = vowelsCount / letterCount * 100;
|
|
2452
|
-
letterPercentages.percentageOfConsonants = consonantsCount / letterCount * 100;
|
|
2453
|
-
}
|
|
2454
2460
|
return {
|
|
2455
2461
|
vowels: {
|
|
2456
2462
|
originalSum: vowelsSum,
|