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.mjs CHANGED
@@ -5806,11 +5806,11 @@ var calculateGematria = (word, options = {}, tree) => {
5806
5806
  if (!tree) {
5807
5807
  tree = createTree({ system: SYSTEM2, parts: [] });
5808
5808
  }
5809
- const includedLetters = /* @__PURE__ */ new Map();
5809
+ const includedLetters = [];
5810
5810
  const words = word.toUpperCase().trim().split(" ");
5811
5811
  let vowelsSum = 0;
5812
5812
  let consonantsSum = 0;
5813
- const presentGematriaNumbers = /* @__PURE__ */ new Set();
5813
+ const includedGematriaValues = /* @__PURE__ */ new Set();
5814
5814
  const letterPercentages = {
5815
5815
  percentageOfVowels: 0,
5816
5816
  percentageOfConsonants: 0,
@@ -5831,8 +5831,8 @@ var calculateGematria = (word, options = {}, tree) => {
5831
5831
  if (isEnding2 && mapping2.data.gematriaValueWhenEnding !== void 0) {
5832
5832
  value = mapping2.data.gematriaValueWhenEnding;
5833
5833
  }
5834
- presentGematriaNumbers.add(value);
5835
- includedLetters.set(latinLetterId2, { letter: combinedLetter, value, hebrewLetter: { id: mapping2.id, data: mapping2.data }, isVowel: isVowel(letter) });
5834
+ includedGematriaValues.add(value);
5835
+ includedLetters.push({ latinLetterId: latinLetterId2, value, hebrewLetterId: mapping2.id, isVowel: isVowel(letter) });
5836
5836
  consonantsSum += value;
5837
5837
  i++;
5838
5838
  continue;
@@ -5853,8 +5853,8 @@ var calculateGematria = (word, options = {}, tree) => {
5853
5853
  if (isEnding && mapping.data.gematriaValueWhenEnding !== void 0) {
5854
5854
  value = mapping.data.gematriaValueWhenEnding;
5855
5855
  }
5856
- presentGematriaNumbers.add(value);
5857
- includedLetters.set(latinLetterId, { letter, value, hebrewLetter: { id: mapping.id, data: mapping.data }, isVowel: isVowel(letter) });
5856
+ includedGematriaValues.add(value);
5857
+ includedLetters.push({ latinLetterId, value, hebrewLetterId: mapping.id, isVowel: isVowel(letter) });
5858
5858
  if (isVowel(letter)) {
5859
5859
  vowelsSum += value;
5860
5860
  } else {
@@ -5862,7 +5862,7 @@ var calculateGematria = (word, options = {}, tree) => {
5862
5862
  }
5863
5863
  }
5864
5864
  }
5865
- if (options?.calculateLetterPercentage) {
5865
+ if (options?.calculateLetterPercentages) {
5866
5866
  const letterCount = letters.length;
5867
5867
  let vowelsCount = 0;
5868
5868
  let consonantsCount = 0;
@@ -5884,27 +5884,30 @@ var calculateGematria = (word, options = {}, tree) => {
5884
5884
  const synthesisReduction = reduceToSingleDigitWithSteps(
5885
5885
  vowelsSum + consonantsSum
5886
5886
  );
5887
- const missingGematriaNumbers = [];
5888
- if (options?.calculateMissingGematriaNumbers) {
5887
+ const missingGematriaValues = [];
5888
+ if (options?.calculateMissingGematriaValues) {
5889
5889
  for (const hebrewLetter of Object.values(HEBREW_LETTERS)) {
5890
- const hebrewLetterNode = tree.getNode(`letter:${hebrewLetter}`);
5890
+ const hebrewLetterId = `letter:${hebrewLetter}`;
5891
+ const hebrewLetterNode = tree.getNode(hebrewLetterId);
5891
5892
  if (!hebrewLetterNode?.data) {
5892
5893
  continue;
5893
5894
  }
5894
- if (!presentGematriaNumbers.has(hebrewLetterNode.data.gematriaValue)) {
5895
- missingGematriaNumbers.push({
5896
- number: hebrewLetterNode.data.gematriaValue,
5897
- letter: hebrewLetter
5895
+ if (!includedGematriaValues.has(hebrewLetterNode.data.gematriaValue)) {
5896
+ missingGematriaValues.push({
5897
+ value: hebrewLetterNode.data.gematriaValue,
5898
+ hebrewLetterId,
5899
+ whenEnding: false
5898
5900
  });
5899
5901
  }
5900
- if (hebrewLetterNode.data.gematriaValueWhenEnding && !presentGematriaNumbers.has(hebrewLetterNode.data.gematriaValueWhenEnding)) {
5901
- missingGematriaNumbers.push({
5902
- number: hebrewLetterNode.data.gematriaValueWhenEnding,
5903
- letter: `${hebrewLetter} (on ending)`
5902
+ if (hebrewLetterNode.data.gematriaValueWhenEnding && !includedGematriaValues.has(hebrewLetterNode.data.gematriaValueWhenEnding)) {
5903
+ missingGematriaValues.push({
5904
+ value: hebrewLetterNode.data.gematriaValueWhenEnding,
5905
+ hebrewLetterId,
5906
+ whenEnding: true
5904
5907
  });
5905
5908
  }
5906
5909
  }
5907
- missingGematriaNumbers.sort((a, b) => a.number - b.number);
5910
+ missingGematriaValues.sort((a, b) => a.value - b.value);
5908
5911
  }
5909
5912
  return {
5910
5913
  vowels: {
@@ -5923,8 +5926,8 @@ var calculateGematria = (word, options = {}, tree) => {
5923
5926
  finalValue: synthesisReduction.finalValue
5924
5927
  },
5925
5928
  includedLetters,
5926
- missingGematriaNumbers: options?.calculateMissingGematriaNumbers ? missingGematriaNumbers : void 0,
5927
- letterPercentages: options?.calculateLetterPercentage ? letterPercentages : void 0
5929
+ missingGematriaValues: options?.calculateMissingGematriaValues ? missingGematriaValues : void 0,
5930
+ letterPercentages: options?.calculateLetterPercentages ? letterPercentages : void 0
5928
5931
  };
5929
5932
  };
5930
5933