kaabalah 1.0.5 → 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/index.js CHANGED
@@ -5842,11 +5842,11 @@ var calculateGematria = (word, options = {}, tree) => {
5842
5842
  if (!tree) {
5843
5843
  tree = createTree({ system: SYSTEM2, parts: [] });
5844
5844
  }
5845
- const includedLetters = /* @__PURE__ */ new Map();
5845
+ const includedLetters = [];
5846
5846
  const words = word.toUpperCase().trim().split(" ");
5847
5847
  let vowelsSum = 0;
5848
5848
  let consonantsSum = 0;
5849
- const presentGematriaNumbers = /* @__PURE__ */ new Set();
5849
+ const includedGematriaValues = /* @__PURE__ */ new Set();
5850
5850
  const letterPercentages = {
5851
5851
  percentageOfVowels: 0,
5852
5852
  percentageOfConsonants: 0,
@@ -5867,8 +5867,8 @@ var calculateGematria = (word, options = {}, tree) => {
5867
5867
  if (isEnding2 && mapping2.data.gematriaValueWhenEnding !== void 0) {
5868
5868
  value = mapping2.data.gematriaValueWhenEnding;
5869
5869
  }
5870
- presentGematriaNumbers.add(value);
5871
- includedLetters.set(latinLetterId2, { letter: combinedLetter, value, hebrewLetter: { id: mapping2.id, data: mapping2.data }, isVowel: isVowel(letter) });
5870
+ includedGematriaValues.add(value);
5871
+ includedLetters.push({ latinLetterId: latinLetterId2, value, hebrewLetterId: mapping2.id, isVowel: isVowel(letter) });
5872
5872
  consonantsSum += value;
5873
5873
  i++;
5874
5874
  continue;
@@ -5889,8 +5889,8 @@ var calculateGematria = (word, options = {}, tree) => {
5889
5889
  if (isEnding && mapping.data.gematriaValueWhenEnding !== void 0) {
5890
5890
  value = mapping.data.gematriaValueWhenEnding;
5891
5891
  }
5892
- presentGematriaNumbers.add(value);
5893
- includedLetters.set(latinLetterId, { letter, value, hebrewLetter: { id: mapping.id, data: mapping.data }, isVowel: isVowel(letter) });
5892
+ includedGematriaValues.add(value);
5893
+ includedLetters.push({ latinLetterId, value, hebrewLetterId: mapping.id, isVowel: isVowel(letter) });
5894
5894
  if (isVowel(letter)) {
5895
5895
  vowelsSum += value;
5896
5896
  } else {
@@ -5898,7 +5898,7 @@ var calculateGematria = (word, options = {}, tree) => {
5898
5898
  }
5899
5899
  }
5900
5900
  }
5901
- if (options?.calculateLetterPercentage) {
5901
+ if (options?.calculateLetterPercentages) {
5902
5902
  const letterCount = letters.length;
5903
5903
  let vowelsCount = 0;
5904
5904
  let consonantsCount = 0;
@@ -5920,27 +5920,29 @@ var calculateGematria = (word, options = {}, tree) => {
5920
5920
  const synthesisReduction = reduceToSingleDigitWithSteps(
5921
5921
  vowelsSum + consonantsSum
5922
5922
  );
5923
- const missingGematriaNumbers = [];
5924
- if (options?.calculateMissingGematriaNumbers) {
5923
+ const missingGematriaValues = [];
5924
+ if (options?.calculateMissingGematriaValues) {
5925
5925
  for (const hebrewLetter of Object.values(HEBREW_LETTERS)) {
5926
5926
  const hebrewLetterNode = tree.getNode(`letter:${hebrewLetter}`);
5927
5927
  if (!hebrewLetterNode?.data) {
5928
5928
  continue;
5929
5929
  }
5930
- if (!presentGematriaNumbers.has(hebrewLetterNode.data.gematriaValue)) {
5931
- missingGematriaNumbers.push({
5932
- number: hebrewLetterNode.data.gematriaValue,
5933
- letter: hebrewLetter
5930
+ if (!includedGematriaValues.has(hebrewLetterNode.data.gematriaValue)) {
5931
+ missingGematriaValues.push({
5932
+ value: hebrewLetterNode.data.gematriaValue,
5933
+ hebrewLetter,
5934
+ whenEnding: false
5934
5935
  });
5935
5936
  }
5936
- if (hebrewLetterNode.data.gematriaValueWhenEnding && !presentGematriaNumbers.has(hebrewLetterNode.data.gematriaValueWhenEnding)) {
5937
- missingGematriaNumbers.push({
5938
- number: hebrewLetterNode.data.gematriaValueWhenEnding,
5939
- letter: `${hebrewLetter} (on ending)`
5937
+ if (hebrewLetterNode.data.gematriaValueWhenEnding && !includedGematriaValues.has(hebrewLetterNode.data.gematriaValueWhenEnding)) {
5938
+ missingGematriaValues.push({
5939
+ value: hebrewLetterNode.data.gematriaValueWhenEnding,
5940
+ hebrewLetter,
5941
+ whenEnding: true
5940
5942
  });
5941
5943
  }
5942
5944
  }
5943
- missingGematriaNumbers.sort((a, b) => a.number - b.number);
5945
+ missingGematriaValues.sort((a, b) => a.value - b.value);
5944
5946
  }
5945
5947
  return {
5946
5948
  vowels: {
@@ -5959,8 +5961,8 @@ var calculateGematria = (word, options = {}, tree) => {
5959
5961
  finalValue: synthesisReduction.finalValue
5960
5962
  },
5961
5963
  includedLetters,
5962
- missingGematriaNumbers: options?.calculateMissingGematriaNumbers ? missingGematriaNumbers : void 0,
5963
- letterPercentages: options?.calculateLetterPercentage ? letterPercentages : void 0
5964
+ missingGematriaValues: options?.calculateMissingGematriaValues ? missingGematriaValues : void 0,
5965
+ letterPercentages: options?.calculateLetterPercentages ? letterPercentages : void 0
5964
5966
  };
5965
5967
  };
5966
5968