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.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,29 @@ 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
5890
  const hebrewLetterNode = tree.getNode(`letter:${hebrewLetter}`);
5891
5891
  if (!hebrewLetterNode?.data) {
5892
5892
  continue;
5893
5893
  }
5894
- if (!presentGematriaNumbers.has(hebrewLetterNode.data.gematriaValue)) {
5895
- missingGematriaNumbers.push({
5896
- number: hebrewLetterNode.data.gematriaValue,
5897
- letter: hebrewLetter
5894
+ if (!includedGematriaValues.has(hebrewLetterNode.data.gematriaValue)) {
5895
+ missingGematriaValues.push({
5896
+ value: hebrewLetterNode.data.gematriaValue,
5897
+ hebrewLetter,
5898
+ whenEnding: false
5898
5899
  });
5899
5900
  }
5900
- if (hebrewLetterNode.data.gematriaValueWhenEnding && !presentGematriaNumbers.has(hebrewLetterNode.data.gematriaValueWhenEnding)) {
5901
- missingGematriaNumbers.push({
5902
- number: hebrewLetterNode.data.gematriaValueWhenEnding,
5903
- letter: `${hebrewLetter} (on ending)`
5901
+ if (hebrewLetterNode.data.gematriaValueWhenEnding && !includedGematriaValues.has(hebrewLetterNode.data.gematriaValueWhenEnding)) {
5902
+ missingGematriaValues.push({
5903
+ value: hebrewLetterNode.data.gematriaValueWhenEnding,
5904
+ hebrewLetter,
5905
+ whenEnding: true
5904
5906
  });
5905
5907
  }
5906
5908
  }
5907
- missingGematriaNumbers.sort((a, b) => a.number - b.number);
5909
+ missingGematriaValues.sort((a, b) => a.value - b.value);
5908
5910
  }
5909
5911
  return {
5910
5912
  vowels: {
@@ -5923,8 +5925,8 @@ var calculateGematria = (word, options = {}, tree) => {
5923
5925
  finalValue: synthesisReduction.finalValue
5924
5926
  },
5925
5927
  includedLetters,
5926
- missingGematriaNumbers: options?.calculateMissingGematriaNumbers ? missingGematriaNumbers : void 0,
5927
- letterPercentages: options?.calculateLetterPercentage ? letterPercentages : void 0
5928
+ missingGematriaValues: options?.calculateMissingGematriaValues ? missingGematriaValues : void 0,
5929
+ letterPercentages: options?.calculateLetterPercentages ? letterPercentages : void 0
5928
5930
  };
5929
5931
  };
5930
5932