kaabalah 1.0.5 → 1.1.1

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,30 @@ 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
- const hebrewLetterNode = tree.getNode(`letter:${hebrewLetter}`);
5926
+ const hebrewLetterId = `letter:${hebrewLetter}`;
5927
+ const hebrewLetterNode = tree.getNode(hebrewLetterId);
5927
5928
  if (!hebrewLetterNode?.data) {
5928
5929
  continue;
5929
5930
  }
5930
- if (!presentGematriaNumbers.has(hebrewLetterNode.data.gematriaValue)) {
5931
- missingGematriaNumbers.push({
5932
- number: hebrewLetterNode.data.gematriaValue,
5933
- letter: hebrewLetter
5931
+ if (!includedGematriaValues.has(hebrewLetterNode.data.gematriaValue)) {
5932
+ missingGematriaValues.push({
5933
+ value: hebrewLetterNode.data.gematriaValue,
5934
+ hebrewLetterId,
5935
+ whenEnding: false
5934
5936
  });
5935
5937
  }
5936
- if (hebrewLetterNode.data.gematriaValueWhenEnding && !presentGematriaNumbers.has(hebrewLetterNode.data.gematriaValueWhenEnding)) {
5937
- missingGematriaNumbers.push({
5938
- number: hebrewLetterNode.data.gematriaValueWhenEnding,
5939
- letter: `${hebrewLetter} (on ending)`
5938
+ if (hebrewLetterNode.data.gematriaValueWhenEnding && !includedGematriaValues.has(hebrewLetterNode.data.gematriaValueWhenEnding)) {
5939
+ missingGematriaValues.push({
5940
+ value: hebrewLetterNode.data.gematriaValueWhenEnding,
5941
+ hebrewLetterId,
5942
+ whenEnding: true
5940
5943
  });
5941
5944
  }
5942
5945
  }
5943
- missingGematriaNumbers.sort((a, b) => a.number - b.number);
5946
+ missingGematriaValues.sort((a, b) => a.value - b.value);
5944
5947
  }
5945
5948
  return {
5946
5949
  vowels: {
@@ -5959,8 +5962,8 @@ var calculateGematria = (word, options = {}, tree) => {
5959
5962
  finalValue: synthesisReduction.finalValue
5960
5963
  },
5961
5964
  includedLetters,
5962
- missingGematriaNumbers: options?.calculateMissingGematriaNumbers ? missingGematriaNumbers : void 0,
5963
- letterPercentages: options?.calculateLetterPercentage ? letterPercentages : void 0
5965
+ missingGematriaValues: options?.calculateMissingGematriaValues ? missingGematriaValues : void 0,
5966
+ letterPercentages: options?.calculateLetterPercentages ? letterPercentages : void 0
5964
5967
  };
5965
5968
  };
5966
5969