kaabalah 1.0.4 → 1.1.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/dist/gematria/index.d.mts +11 -10
- package/dist/gematria/index.d.ts +11 -10
- package/dist/gematria/index.js +80 -72
- package/dist/gematria/index.js.map +1 -1
- package/dist/gematria/index.mjs +80 -72
- package/dist/gematria/index.mjs.map +1 -1
- package/dist/index.js +80 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -72
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5842,99 +5842,107 @@ var calculateGematria = (word, options = {}, tree) => {
|
|
|
5842
5842
|
if (!tree) {
|
|
5843
5843
|
tree = createTree({ system: SYSTEM2, parts: [] });
|
|
5844
5844
|
}
|
|
5845
|
-
const includedLetters =
|
|
5846
|
-
const
|
|
5845
|
+
const includedLetters = [];
|
|
5846
|
+
const words = word.toUpperCase().trim().split(" ");
|
|
5847
5847
|
let vowelsSum = 0;
|
|
5848
5848
|
let consonantsSum = 0;
|
|
5849
|
-
const
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5849
|
+
const includedGematriaValues = /* @__PURE__ */ new Set();
|
|
5850
|
+
const letterPercentages = {
|
|
5851
|
+
percentageOfVowels: 0,
|
|
5852
|
+
percentageOfConsonants: 0,
|
|
5853
|
+
letters: {}
|
|
5854
|
+
};
|
|
5855
|
+
for (const word2 of words) {
|
|
5856
|
+
const letters = word2.split("");
|
|
5857
|
+
for (let i = 0; i < letters.length; i++) {
|
|
5858
|
+
const letter = letters[i].toLocaleUpperCase();
|
|
5859
|
+
const nextLetter = letters[i + 1]?.toLocaleLowerCase() || "";
|
|
5860
|
+
if (["P", "T", "K", "S", "C"].includes(letter) && nextLetter) {
|
|
5861
|
+
const combinedLetter = letter + nextLetter;
|
|
5862
|
+
const isEnding2 = i > 0 && i === letters.length - 2;
|
|
5863
|
+
const latinLetterId2 = `letter:${combinedLetter}`;
|
|
5864
|
+
const [mapping2] = tree.walk(latinLetterId2, 2, "hebrewLetter");
|
|
5865
|
+
if (mapping2?.data) {
|
|
5866
|
+
let value = mapping2.data.gematriaValue;
|
|
5867
|
+
if (isEnding2 && mapping2.data.gematriaValueWhenEnding !== void 0) {
|
|
5868
|
+
value = mapping2.data.gematriaValueWhenEnding;
|
|
5869
|
+
}
|
|
5870
|
+
includedGematriaValues.add(value);
|
|
5871
|
+
includedLetters.push({ latinLetterId: latinLetterId2, value, hebrewLetterId: mapping2.id, isVowel: isVowel(letter) });
|
|
5872
|
+
consonantsSum += value;
|
|
5873
|
+
i++;
|
|
5874
|
+
continue;
|
|
5861
5875
|
}
|
|
5862
|
-
presentGematriaNumbers.add(value);
|
|
5863
|
-
includedLetters.set(mapping2.id, { letter: combinedLetter, value, hebrewLetter: mapping2.data, isVowel: isVowel(letter) });
|
|
5864
|
-
consonantsSum += value;
|
|
5865
|
-
i++;
|
|
5866
|
-
continue;
|
|
5867
|
-
}
|
|
5868
|
-
}
|
|
5869
|
-
let mapping;
|
|
5870
|
-
const isStarting = i === 0;
|
|
5871
|
-
if (isStarting && letter === "O") {
|
|
5872
|
-
mapping = tree.getNode(`letter:${HEBREW_LETTERS.AIN}`);
|
|
5873
|
-
} else {
|
|
5874
|
-
mapping = tree.walk(`letter:${letter}`, 2, "hebrewLetter").at(0);
|
|
5875
|
-
}
|
|
5876
|
-
const isEnding = i > 0 && i === letters.length - 1;
|
|
5877
|
-
if (mapping?.data) {
|
|
5878
|
-
let value = mapping.data.gematriaValue;
|
|
5879
|
-
if (isEnding && mapping.data.gematriaValueWhenEnding !== void 0) {
|
|
5880
|
-
value = mapping.data.gematriaValueWhenEnding;
|
|
5881
5876
|
}
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5877
|
+
let mapping;
|
|
5878
|
+
let latinLetterId = `letter:${letter}`;
|
|
5879
|
+
const isStarting = i === 0;
|
|
5880
|
+
if (isStarting && letter === "O") {
|
|
5881
|
+
latinLetterId = `letter:${HEBREW_LETTERS.AIN}`;
|
|
5882
|
+
mapping = tree.getNode(latinLetterId);
|
|
5886
5883
|
} else {
|
|
5887
|
-
|
|
5884
|
+
mapping = tree.walk(latinLetterId, 2, "hebrewLetter").at(0);
|
|
5885
|
+
}
|
|
5886
|
+
const isEnding = i > 0 && i === letters.length - 1;
|
|
5887
|
+
if (mapping?.data) {
|
|
5888
|
+
let value = mapping.data.gematriaValue;
|
|
5889
|
+
if (isEnding && mapping.data.gematriaValueWhenEnding !== void 0) {
|
|
5890
|
+
value = mapping.data.gematriaValueWhenEnding;
|
|
5891
|
+
}
|
|
5892
|
+
includedGematriaValues.add(value);
|
|
5893
|
+
includedLetters.push({ latinLetterId, value, hebrewLetterId: mapping.id, isVowel: isVowel(letter) });
|
|
5894
|
+
if (isVowel(letter)) {
|
|
5895
|
+
vowelsSum += value;
|
|
5896
|
+
} else {
|
|
5897
|
+
consonantsSum += value;
|
|
5898
|
+
}
|
|
5888
5899
|
}
|
|
5889
5900
|
}
|
|
5901
|
+
if (options?.calculateLetterPercentages) {
|
|
5902
|
+
const letterCount = letters.length;
|
|
5903
|
+
let vowelsCount = 0;
|
|
5904
|
+
let consonantsCount = 0;
|
|
5905
|
+
for (const letter of new Set(letters)) {
|
|
5906
|
+
const occurrences = letters.filter((l) => l === letter).length;
|
|
5907
|
+
letterPercentages.letters[letter] = occurrences / letterCount * 100;
|
|
5908
|
+
if (isVowel(letter)) {
|
|
5909
|
+
vowelsCount += occurrences;
|
|
5910
|
+
} else {
|
|
5911
|
+
consonantsCount += occurrences;
|
|
5912
|
+
}
|
|
5913
|
+
}
|
|
5914
|
+
letterPercentages.percentageOfVowels = vowelsCount / letterCount * 100;
|
|
5915
|
+
letterPercentages.percentageOfConsonants = consonantsCount / letterCount * 100;
|
|
5916
|
+
}
|
|
5890
5917
|
}
|
|
5891
5918
|
const vowelsReduction = reduceToSingleDigitWithSteps(vowelsSum);
|
|
5892
5919
|
const consonantsReduction = reduceToSingleDigitWithSteps(consonantsSum);
|
|
5893
5920
|
const synthesisReduction = reduceToSingleDigitWithSteps(
|
|
5894
5921
|
vowelsSum + consonantsSum
|
|
5895
5922
|
);
|
|
5896
|
-
const
|
|
5897
|
-
if (options?.
|
|
5923
|
+
const missingGematriaValues = [];
|
|
5924
|
+
if (options?.calculateMissingGematriaValues) {
|
|
5898
5925
|
for (const hebrewLetter of Object.values(HEBREW_LETTERS)) {
|
|
5899
5926
|
const hebrewLetterNode = tree.getNode(`letter:${hebrewLetter}`);
|
|
5900
5927
|
if (!hebrewLetterNode?.data) {
|
|
5901
5928
|
continue;
|
|
5902
5929
|
}
|
|
5903
|
-
if (!
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5930
|
+
if (!includedGematriaValues.has(hebrewLetterNode.data.gematriaValue)) {
|
|
5931
|
+
missingGematriaValues.push({
|
|
5932
|
+
value: hebrewLetterNode.data.gematriaValue,
|
|
5933
|
+
hebrewLetter,
|
|
5934
|
+
whenEnding: false
|
|
5907
5935
|
});
|
|
5908
5936
|
}
|
|
5909
|
-
if (hebrewLetterNode.data.gematriaValueWhenEnding && !
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5937
|
+
if (hebrewLetterNode.data.gematriaValueWhenEnding && !includedGematriaValues.has(hebrewLetterNode.data.gematriaValueWhenEnding)) {
|
|
5938
|
+
missingGematriaValues.push({
|
|
5939
|
+
value: hebrewLetterNode.data.gematriaValueWhenEnding,
|
|
5940
|
+
hebrewLetter,
|
|
5941
|
+
whenEnding: true
|
|
5913
5942
|
});
|
|
5914
5943
|
}
|
|
5915
5944
|
}
|
|
5916
|
-
|
|
5917
|
-
}
|
|
5918
|
-
const letterPercentages = {
|
|
5919
|
-
percentageOfVowels: 0,
|
|
5920
|
-
percentageOfConsonants: 0,
|
|
5921
|
-
letters: {}
|
|
5922
|
-
};
|
|
5923
|
-
if (options?.calculateLetterPercentage) {
|
|
5924
|
-
const letterCount = letters.length;
|
|
5925
|
-
let vowelsCount = 0;
|
|
5926
|
-
let consonantsCount = 0;
|
|
5927
|
-
for (const [_, letter] of includedLetters) {
|
|
5928
|
-
const occurrences = letters.filter((l) => l === letter.letter).length;
|
|
5929
|
-
letterPercentages.letters[letter.letter] = occurrences / letterCount * 100;
|
|
5930
|
-
if (letter.isVowel) {
|
|
5931
|
-
vowelsCount += occurrences;
|
|
5932
|
-
} else {
|
|
5933
|
-
consonantsCount += occurrences;
|
|
5934
|
-
}
|
|
5935
|
-
}
|
|
5936
|
-
letterPercentages.percentageOfVowels = vowelsCount / letterCount * 100;
|
|
5937
|
-
letterPercentages.percentageOfConsonants = consonantsCount / letterCount * 100;
|
|
5945
|
+
missingGematriaValues.sort((a, b) => a.value - b.value);
|
|
5938
5946
|
}
|
|
5939
5947
|
return {
|
|
5940
5948
|
vowels: {
|
|
@@ -5953,8 +5961,8 @@ var calculateGematria = (word, options = {}, tree) => {
|
|
|
5953
5961
|
finalValue: synthesisReduction.finalValue
|
|
5954
5962
|
},
|
|
5955
5963
|
includedLetters,
|
|
5956
|
-
|
|
5957
|
-
letterPercentages: options?.
|
|
5964
|
+
missingGematriaValues: options?.calculateMissingGematriaValues ? missingGematriaValues : void 0,
|
|
5965
|
+
letterPercentages: options?.calculateLetterPercentages ? letterPercentages : void 0
|
|
5958
5966
|
};
|
|
5959
5967
|
};
|
|
5960
5968
|
|