@todo-esta-bien/numerodon
Version:
Library to calculate numeric values from names or dates
694 lines (685 loc) • 32 kB
JavaScript
const VOWELS = ["a", "e", "i", "o", "u"];
const reduceNumberDigits = ({ sumRecursively = false, stopNumbers = [] } = {}) => (number) => {
if (stopNumbers.includes(number)) {
return number;
}
const result = `${number}` // e.g. '421'
.split("") // e.g. ['4', '2', '1']
.map((i) => +i) // e.g. [4, 2, 1]
.reduce((carr, el) => carr + el); // e.g. 4 + 2 + 1
return result < 10 || !sumRecursively ? result : reduceNumberDigits({ sumRecursively, stopNumbers })(result);
};
const getLetterValue = (letter) => {
const letterNumberMap = {
ajs: 1,
bkt: 2,
clu: 3,
dmv: 4,
enw: 5,
fox: 6,
gpy: 7,
hqz: 8,
ir: 9,
};
if (letter.length > 1)
return -1;
const [_, value] = Object.entries(letterNumberMap).find(([key, _]) => key.includes(letter)) || [null, -1];
return value;
};
const cleanString = (str) => str // e.g. 'María Rodríguez'
.toLowerCase() // e.g. 'maría rodríguez'
.normalize("NFD") // e.g. 'mar´ia rodr´iguez'
.replace(/\p{Diacritic}/gu, ""); // e.g. 'maria rodriguez'
const getLetterSumFromWord = (word, numberReducer) => {
// We expect the word to be cleaned and in lowercase
const letters = word.split("");
let vowelSum = 0;
let consonantSum = 0;
let leftPointer = 0;
// Y may be considered as vowel or consonant based on its position:
// - if Y is next to a vowel, it's a consonant
// - if Y is next to a consonant, it's a vowel
// - if Y is the last letter of the word, it's a vowel
// Iterate each letter with the rightPointer
for (let rightPointer = 0; rightPointer < letters.length; rightPointer++) {
const currentLetter = letters[rightPointer];
// If previous letter was 'y'
if (rightPointer !== leftPointer) {
// If current letter is vowel
if (VOWELS.includes(currentLetter)) {
// 'y' is consonant
consonantSum += getLetterValue("y");
}
else {
// 'y' is vowel
vowelSum += getLetterValue("y");
}
// Sync pointers again
leftPointer = rightPointer;
}
if (currentLetter === "y") {
if (rightPointer === letters.length - 1) {
// last letter of the word, 'y' is vowel
vowelSum += getLetterValue("y");
}
// continue to see if the next letter is vowel or consonant
continue;
}
if (VOWELS.includes(currentLetter)) {
vowelSum += getLetterValue(currentLetter);
}
else {
consonantSum += getLetterValue(currentLetter);
}
leftPointer += 1;
}
return {
vowelSum: numberReducer(vowelSum),
consonantSum: numberReducer(consonantSum),
totalSum: numberReducer(vowelSum + consonantSum),
};
};
const getLetterSumFromString = (str, reduceNumberAttrs = {}) => {
const numberReducer = reduceNumberDigits(reduceNumberAttrs);
const addedResult = cleanString(str) // e.g. 'María Rodríguez' -> 'maria rodriguez'
.split(" ") // e.g. ['maria', 'rodriguez']
.map((word) => getLetterSumFromWord(word, numberReducer)) // e.g. [{vowelSum...}, {vowelSum...}]
.reduce((prevResult, currentResult) => ({
// e.g. {vowelSum...}
vowelSum: prevResult.vowelSum + currentResult.vowelSum,
consonantSum: prevResult.consonantSum + currentResult.consonantSum,
totalSum: prevResult.totalSum + currentResult.totalSum,
}));
return {
vowelSum: numberReducer(addedResult.vowelSum),
consonantSum: numberReducer(addedResult.consonantSum),
totalSum: numberReducer(addedResult.totalSum),
};
};
const repeatArrayElements = (originalArray, elementsAmount) => {
if (elementsAmount <= originalArray.length) {
return originalArray.slice(0, elementsAmount);
}
const completeTimes = Math.floor(elementsAmount / originalArray.length);
const repeatedCompleteArrays = Array.from({ length: completeTimes }, (_) => [...originalArray]).flat();
const remainder = elementsAmount % originalArray.length;
const missingElements = Array.from({ length: remainder }, (_, idx) => originalArray[idx]);
return [...repeatedCompleteArrays, ...missingElements];
};
const generateExpandedNames = (str, expansionLimit) => {
const cleanedNameLetters = cleanString(str).replace(/\s/g, "").split("");
if (cleanedNameLetters.length === 0) {
return new Array(expansionLimit).fill(" ");
}
const result = [];
let currentLetterIdx = 0;
let repetitionsCount = 0;
let letterMaxRepetitions = getLetterValue(cleanedNameLetters[currentLetterIdx]);
for (let i = 0; i < expansionLimit; i++) {
if (repetitionsCount >= letterMaxRepetitions) {
currentLetterIdx = (currentLetterIdx + 1) % cleanedNameLetters.length;
repetitionsCount = 0;
letterMaxRepetitions = getLetterValue(cleanedNameLetters[currentLetterIdx]);
}
result.push(cleanedNameLetters[currentLetterIdx]);
repetitionsCount++;
}
return result;
};
const generateExpandedLetterCount = (str) => {
const result = [];
let currentLetter = str[0];
let currentLetterCount = 0;
for (const char of str) {
if (currentLetter !== char) {
currentLetter = char;
currentLetterCount = 0;
}
result.push(++currentLetterCount);
}
return result;
};
const getDaysInMonth = (year, month) => {
const daysInMonth = [];
const startDate = new Date(year, month, 1);
while (startDate.getMonth() === month) {
daysInMonth.push(startDate.getDate());
startDate.setDate(startDate.getDate() + 1);
}
return daysInMonth;
};
class TantricProfile {
day;
month;
year;
soul;
karma;
divineGift;
lastLife;
path;
tantricSumOptions = {
sumRecursively: true,
stopNumbers: [10, 11, 22, 33, 44],
};
numberReducer = reduceNumberDigits(this.tantricSumOptions);
constructor({ day, month, year }) {
this.day = day;
this.month = month;
this.year = year;
this.soul = this.numberReducer(day);
this.karma = this.numberReducer(month);
this.divineGift = this.numberReducer(year % 100); // Only last two digits from year
this.lastLife = this.numberReducer(year);
// We're adding, and not concatenating, because in order to be a 33 you need to be super spiritual, and
// there's a very low chance that it could be happening.
// If for some reason we want to get back to the 33 calculations, uncomment this line:
// this.path = this.numberReducer(+`${day}${month}${year}`);
this.path = this.numberReducer(day + month + year);
}
}
class PythagoreanProfile {
day;
month;
year;
names;
fatherLastNames;
motherLastNames;
completeName;
completeNameSumResult;
soul;
personality;
expression;
cosmicMission;
balance;
strength;
spiritualInitiation;
lifePath;
pythagoreanSumOptions = {
sumRecursively: true,
stopNumbers: [11, 22, 33, 44],
};
numberReducer = reduceNumberDigits(this.pythagoreanSumOptions);
constructor({ day, month, year, names, fatherLastNames, motherLastNames }) {
this.day = day;
this.month = month;
this.year = year;
this.names = names;
this.fatherLastNames = fatherLastNames;
this.motherLastNames = motherLastNames;
this.completeName = `${names} ${fatherLastNames} ${motherLastNames}`;
this.completeNameSumResult = getLetterSumFromString(this.completeName, this.pythagoreanSumOptions);
this.soul = this.completeNameSumResult.vowelSum;
this.personality = this.completeNameSumResult.consonantSum;
this.expression = this.completeNameSumResult.totalSum;
// We're adding, and not concatenating, because in order to be a 33 you need to be super spiritual, and
// there's a very low chance that it could be happening.
// If for some reason we want to get back to the 33 calculations, uncomment this line:
// this.cosmicMission = this.numberReducer(+`${this.completeNameSumResult.totalSum}${day}${month}${year}`);
this.cosmicMission = this.numberReducer(this.completeNameSumResult.totalSum + day + month + year);
this.balance = this.getCompleteNameInitialsSum(this.completeName);
this.strength = this.numberReducer(day + month);
this.lifePath = this.numberReducer(day + month + year);
this.spiritualInitiation = this.numberReducer(this.soul + this.expression + day + this.lifePath);
}
getCompleteNameInitialsSum(completeName) {
const concatenatedInitials = completeName
.split(" ")
.map((name) => name[0])
.join("");
const letterSumResult = getLetterSumFromString(concatenatedInitials, this.pythagoreanSumOptions);
return letterSumResult.totalSum;
}
}
class PythagoreanPinnacle {
month;
day;
year;
karma; // A
personal; // B
pastLife; // C
personality; // D
firstRealization; // E
secondRealization; // F
thirdRealization; // G
fourthRealization; // H
destiny; // H
subconscious; // I
unconscious; // J
firstGoal; // K
secondGoal; // L
thirdGoal; // M
fourthGoal; // N
negativeUnconscious; // O
shadow; // P
familyInferiorBeing; // Q
consciousInferiorBeing; // R
latentInferiorBeing; // S
absences; // T
triplicities; // W
firstLifeStage;
secondLifeStage;
thirdLifeStage;
pythagoreanPinnacleSumOptions = {
sumRecursively: true,
stopNumbers: [11, 22, 33, 44],
};
numberReducer = reduceNumberDigits(this.pythagoreanPinnacleSumOptions);
constructor({ day, month, year }) {
this.day = day;
this.month = month;
this.year = year;
this.karma = this.numberReducer(month);
this.personal = this.numberReducer(day);
this.pastLife = this.numberReducer(year);
this.personality = this.numberReducer(day + month + year);
this.firstRealization = this.numberReducer(month + day);
this.secondRealization = this.numberReducer(day + year);
this.thirdRealization = this.numberReducer(month + 2 * day + year);
this.fourthRealization = this.numberReducer(month + year);
this.destiny = this.fourthRealization;
this.subconscious = this.numberReducer(this.firstRealization + this.secondRealization + this.thirdRealization);
this.unconscious = this.numberReducer(this.personality + this.fourthRealization);
// Below numbers needs to use reduced versions (with no stop numbers) of day, month and year
const reducedMonth = reduceNumberDigits({ sumRecursively: true })(month);
const reducedDay = reduceNumberDigits({ sumRecursively: true })(day);
const reducedYear = reduceNumberDigits({ sumRecursively: true })(year);
this.firstGoal = this.numberReducer(Math.abs(reducedMonth - reducedDay));
this.secondGoal = this.numberReducer(Math.abs(reducedDay - reducedYear));
this.thirdGoal = this.numberReducer(Math.abs(this.firstGoal - this.secondGoal));
this.fourthGoal = this.numberReducer(Math.abs(reducedMonth - reducedYear));
this.negativeUnconscious = this.numberReducer(this.firstGoal + this.secondGoal + this.thirdGoal);
this.shadow = this.numberReducer(this.personality + this.negativeUnconscious);
this.familyInferiorBeing = this.numberReducer(this.firstGoal + this.thirdGoal);
this.consciousInferiorBeing = this.numberReducer(this.secondGoal + this.thirdGoal);
this.latentInferiorBeing = this.numberReducer(this.familyInferiorBeing + this.consciousInferiorBeing);
this.absences = this.calculateAbsences([
this.karma,
this.personal,
this.pastLife,
this.personality,
this.firstRealization,
this.secondRealization,
this.thirdRealization,
this.fourthRealization,
this.destiny,
this.subconscious,
this.unconscious,
this.firstGoal,
this.secondGoal,
this.thirdGoal,
this.fourthGoal,
this.negativeUnconscious,
this.shadow,
this.familyInferiorBeing,
this.consciousInferiorBeing,
this.latentInferiorBeing,
]);
this.triplicities = this.calculateTriplicities([
this.firstGoal,
this.secondGoal,
this.thirdGoal,
this.fourthGoal,
this.negativeUnconscious,
this.shadow,
this.familyInferiorBeing,
this.consciousInferiorBeing,
this.latentInferiorBeing,
]);
// 36 because 🤷
this.firstLifeStage = 36 - this.personality;
// 9 because 🤷
this.secondLifeStage = this.firstLifeStage + 9;
this.thirdLifeStage = this.secondLifeStage + 9;
}
calculateAbsences(pinnacleNumbers) {
// This is the missing number from 1 to 9, that is not present in all of the pinnacle numbers
const sortedPinnacleNumbers = new Set(pinnacleNumbers); // e.g. [2, 2, 2, 3, 4, 5, 6, 7, 8]
const neededNumbers = Array.from({ length: 9 }, (_, idx) => idx + 1); // e.g. [1, 2, ... 8, 9]
return neededNumbers.filter((neededNumber) => !sortedPinnacleNumbers.has(neededNumber)); // e.g. [1, 9]
}
calculateTriplicities(negativeNumbers) {
// If we have more than 3 equal numbers in the negative numbers, we should add that repeated number 3 times,
// and reduce it to one digit (except for 11 and 22)
const sortedNegativeNumbers = [...negativeNumbers].sort();
const repeatedNumbers = sortedNegativeNumbers.reduce((repeatedNumbers, currentNumber) => {
const currentCount = repeatedNumbers[currentNumber] || 0;
repeatedNumbers[currentNumber] = currentCount + 1;
return repeatedNumbers;
}, {});
const bruteSuperHiddens = Object.entries(repeatedNumbers) // e.g. [['3', 1], ['12', 3], ['15', 4]]
.filter(([, count]) => count >= 3) // e.g. [['12', 3], ['15', 4]]
.map(([numberValue]) => +numberValue) // e.g. [12, 15]
.map((numberValue) => this.numberReducer(3 * numberValue)); // e.g. [9, 9]
return bruteSuperHiddens;
}
}
class DestinyTable {
day;
month;
year;
names;
fatherLastNames;
motherLastNames;
expandedYears;
expandedAge;
expandedMentalPlane;
expandedMentalPlaneLetterValues;
expandedMentalPlaneLetterCount;
expandedPhysicalPlane;
expandedPhysicalPlaneLetterValues;
expandedPhysicalPlaneLetterCount;
expandedEmotionalPlane;
expandedEmotionalPlaneLetterValues;
expandedEmotionalPlaneLetterCount;
expandedSpiritualPlane;
expandedDestinyNumber;
expandedPersonalYears;
expandedRealizationNumbers;
expandedCrisisPeriods;
destinyTableSumOptions = {
sumRecursively: true,
stopNumbers: [11, 22],
};
numberReducer = reduceNumberDigits(this.destinyTableSumOptions);
// Last row of the destiny table
yearExpansionLimit;
DEFAULT_YEAR_EXPANSION_LIMIT = 102;
constructor({ day, month, year, names, fatherLastNames, motherLastNames, yearExpansionLimit, }) {
this.yearExpansionLimit = yearExpansionLimit || this.DEFAULT_YEAR_EXPANSION_LIMIT;
this.day = day;
this.month = month;
this.year = year;
this.names = names;
this.fatherLastNames = fatherLastNames;
this.motherLastNames = motherLastNames;
this.expandedYears = Array.from({ length: this.yearExpansionLimit }, (_, i) => i + this.year);
this.expandedAge = Array.from({ length: this.yearExpansionLimit }, (_, i) => i);
this.expandedMentalPlane = generateExpandedNames(this.names, this.yearExpansionLimit);
this.expandedMentalPlaneLetterValues = this.expandedMentalPlane.map((letter) => getLetterValue(letter));
this.expandedMentalPlaneLetterCount = generateExpandedLetterCount(this.expandedMentalPlane);
this.expandedPhysicalPlane = generateExpandedNames(this.fatherLastNames, this.yearExpansionLimit);
this.expandedPhysicalPlaneLetterValues = this.expandedPhysicalPlane.map((letter) => getLetterValue(letter));
this.expandedPhysicalPlaneLetterCount = generateExpandedLetterCount(this.expandedPhysicalPlane);
this.expandedEmotionalPlane = generateExpandedNames(this.motherLastNames, this.yearExpansionLimit);
this.expandedEmotionalPlaneLetterValues = this.expandedEmotionalPlane.map((letter) => getLetterValue(letter));
this.expandedEmotionalPlaneLetterCount = generateExpandedLetterCount(this.expandedEmotionalPlane);
this.expandedPersonalYears = this.expandedYears.map((year) => this.numberReducer(year + this.month + this.day));
this.expandedSpiritualPlane = Array.from({ length: this.yearExpansionLimit }, (_, i) => reduceNumberDigits({ sumRecursively: true, stopNumbers: [11, 13, 14, 16, 19, 22] })(this.expandedMentalPlaneLetterValues[i] +
this.expandedPhysicalPlaneLetterValues[i] +
this.expandedEmotionalPlaneLetterValues[i]));
this.expandedDestinyNumber = Array.from({ length: this.yearExpansionLimit }, (_, i) => this.numberReducer(this.expandedMentalPlaneLetterValues[i] +
this.expandedPhysicalPlaneLetterValues[i] +
this.expandedEmotionalPlaneLetterValues[i] +
this.expandedPersonalYears[i]));
const pinnacle = new PythagoreanPinnacle({ day, month, year });
this.expandedRealizationNumbers = this.generateExpandedRealizationNumbers(pinnacle);
const completeName = `${names} ${fatherLastNames} ${motherLastNames}`;
this.expandedCrisisPeriods = this.generateCrisisPeriods(cleanString(completeName).replace(/\s/g, "").length, this.yearExpansionLimit);
}
generateCrisisPeriods(nameLettersAmount, yearExpansionLimit) {
const basePeriod = nameLettersAmount / 2;
const periodsAmount = Math.floor(yearExpansionLimit / basePeriod);
return Array.from({ length: periodsAmount }, (_, i) => Math.ceil(basePeriod * (i + 1)));
}
generateExpandedRealizationNumbers(pinnacle) {
const result = [];
// Values which will fill the realization list for the destiny table
const fillers = [
`${pinnacle.firstRealization}`,
`${pinnacle.secondRealization}`,
`${pinnacle.thirdRealization}`,
`${pinnacle.fourthRealization}`,
`${pinnacle.fourthRealization}|${pinnacle.thirdRealization}`,
`${pinnacle.fourthRealization}|${pinnacle.secondRealization}`,
`${pinnacle.fourthRealization}|${pinnacle.firstRealization}`,
`${pinnacle.fourthRealization}|${pinnacle.secondRealization}`,
`${pinnacle.fourthRealization}|${pinnacle.thirdRealization}`,
`${pinnacle.fourthRealization}|${pinnacle.fourthRealization}`,
];
// numerology 🤷
const NEXT_STAGE_INCREMENT = 9;
let fillerIdx = 0;
let nextChangeIdx = pinnacle.firstLifeStage;
for (let i = 0; i < this.yearExpansionLimit; i++) {
if (i === nextChangeIdx) {
nextChangeIdx += NEXT_STAGE_INCREMENT;
fillerIdx += fillerIdx + 1 < fillers.length ? 1 : 0;
}
result.push(fillers[fillerIdx]);
}
return result;
}
}
class EvolutiveProfile {
day;
month;
year;
names;
fatherLastNames;
motherLastNames;
completeName;
completeNameChars;
residents;
personalYears;
evolutiveSumOptions = {
sumRecursively: true,
stopNumbers: [11, 22],
};
numberReducer = reduceNumberDigits(this.evolutiveSumOptions);
constructor({ day, month, year, names, fatherLastNames, motherLastNames }) {
this.day = day;
this.month = month;
this.year = year;
this.names = names;
this.fatherLastNames = fatherLastNames;
this.motherLastNames = motherLastNames;
this.completeName = `${names} ${fatherLastNames} ${motherLastNames}`;
const cleanCompleteNameWithoutSpaces = cleanString(this.completeName.replace(/\s/g, ""));
this.completeNameChars = cleanCompleteNameWithoutSpaces.length;
this.residents = this.getResidents(cleanCompleteNameWithoutSpaces);
this.personalYears = this.getPersonalYears(day, month, year);
}
/**
* Generates the residents (repeated times of a letter value) starting from the 1 to the 9
*
* @param {string} cleanCompleteNameWithoutSpaces - The complete name without spaces or accents
* @returns {EvolutiveNumbers} The 9 length array from values from 1 to 9 of the repeated values
*/
getResidents(cleanCompleteNameWithoutSpaces) {
return cleanCompleteNameWithoutSpaces.split("").reduce((acc, letter) => {
const letterValue = getLetterValue(letter);
acc[letterValue - 1] += 1;
return acc;
}, new Array(9).fill(0));
}
/**
* Generates the personal years, but considering the "master numbers". This starts based on the birthYear,
* and should be matched manually with the residents.
*
* @param {number} day - The day of birth of the user
* @param {number} month - The month of birth of the user
* @param {number} year - The year of birth of the user
* @returns {EvolutiveNumbers} The 9 length array from values from 1 to 9 (may include 11 or 22),
* starting with the personal year of the user
*/
getPersonalYears(day, month, year) {
return new Array(9).fill(0).map((_, idx) => {
return this.numberReducer(day + month + year + idx);
});
}
}
class Base22Profile {
day;
month;
year;
deepPersonality; // PP
emotionalKnot; // NE
emotionalSearch; // QE
internalSocialBehavior; // CIS
externalSocialBehavior; // CES
externalSocialPersonality; // PES
harmonySearch; // RH
spiritualSearch; // QS
resistanceNumber; // NR
emerge; // RS
painKnot; // ND
internalDefenseBehavior; // CID
externalDefenseBehavior; // CED
externalDefensePersonality; // PED
externalExitSearch; // RE
escapeNumber; // NF
firstSpiritualBaseA; // 1A
firstSpiritualBaseB; // 1B
firstSpiritualBaseC; // 1C
secondSpiritualBaseA; // 2A
secondSpiritualBaseB; // 2B
secondSpiritualBaseC; // 2C
thirdSpiritualBaseA; // 3A
base22SumOptions = {
sumRecursively: true,
stopNumbers: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 26, 30, 33, 40, 44],
};
numberReducer = reduceNumberDigits(this.base22SumOptions);
reducedDay;
reducedMonth;
reducedYear;
constructor({ day, month, year }) {
this.day = day;
this.month = month;
this.year = year;
// Delegating the presentation of the reduced number to the frontend
// so we're leaving potential numbers above 22
const lastReducer = reduceNumberDigits({
sumRecursively: false,
stopNumbers: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22],
});
this.reducedDay = this.numberReducer(this.day);
this.reducedMonth = this.numberReducer(this.month);
this.reducedYear = this.numberReducer(this.year);
this.deepPersonality = this.numberReducer(this.reducedDay + this.reducedMonth + this.reducedYear); // PP
const reducedDeepPersonality = lastReducer(this.deepPersonality);
this.emotionalKnot = this.numberReducer(this.reducedDay + this.reducedYear); // NE
const reducedEmotionalKnot = lastReducer(this.emotionalKnot);
this.emotionalSearch = this.numberReducer(reducedDeepPersonality + reducedEmotionalKnot); // QE
this.internalSocialBehavior = this.numberReducer(this.reducedDay + this.reducedMonth); // CIS
const reducedInternalSocialBehavior = lastReducer(this.internalSocialBehavior);
this.externalSocialBehavior = this.numberReducer(this.reducedMonth + this.reducedYear); // CES
const reducedExternalSocialBehavior = lastReducer(this.externalSocialBehavior);
this.externalSocialPersonality = this.numberReducer(reducedInternalSocialBehavior + reducedExternalSocialBehavior); // PES
const reducedExternalSocialPersonality = lastReducer(this.externalSocialPersonality);
this.harmonySearch = this.numberReducer(reducedDeepPersonality + reducedExternalSocialPersonality); // RH
const reducedHarmonySearch = lastReducer(this.harmonySearch);
this.spiritualSearch = this.numberReducer(this.reducedMonth + reducedDeepPersonality); // QS
const resistanceNumber = this.getResistanceNumber([this.reducedYear, this.reducedMonth, this.reducedDay]); // NR
this.resistanceNumber = resistanceNumber === 0 ? 22 : resistanceNumber;
const reducedResistanceNumber = lastReducer(this.resistanceNumber);
this.emerge = this.numberReducer(reducedResistanceNumber + reducedExternalSocialPersonality); // RS
const reducedEmerge = lastReducer(this.emerge);
this.painKnot = this.numberReducer(Math.abs(this.reducedYear - this.reducedDay)); // ND
this.internalDefenseBehavior = this.numberReducer(Math.abs(this.reducedDay - this.reducedMonth)); // CID
const reducedInternalDefenseBehavior = lastReducer(this.internalDefenseBehavior);
this.externalDefenseBehavior = this.numberReducer(Math.abs(this.reducedYear - this.reducedMonth)); // CED
const reducedExternalDefenseBehavior = lastReducer(this.externalDefenseBehavior);
this.externalDefensePersonality = this.numberReducer(Math.abs(reducedInternalDefenseBehavior - reducedExternalDefenseBehavior)); // PED
const reducedExternalDefensePersonality = lastReducer(this.externalDefensePersonality);
this.externalExitSearch = this.numberReducer(Math.abs(reducedDeepPersonality - reducedExternalDefensePersonality)); // RE
this.escapeNumber = this.numberReducer(Math.abs(reducedResistanceNumber - reducedExternalDefensePersonality)); // NF
this.firstSpiritualBaseA = this.numberReducer(reducedEmerge + reducedExternalSocialPersonality); // 1A
const reducedFirstSpiritualBaseA = lastReducer(this.firstSpiritualBaseA);
this.firstSpiritualBaseB = this.numberReducer(reducedEmerge + reducedHarmonySearch); // 1B
const reducedFirstSpiritualBaseB = lastReducer(this.firstSpiritualBaseB);
this.firstSpiritualBaseC = this.numberReducer(reducedExternalSocialPersonality + reducedHarmonySearch); // 1C
const reducedFirstSpiritualBaseC = lastReducer(this.firstSpiritualBaseC);
this.secondSpiritualBaseA = this.numberReducer(reducedFirstSpiritualBaseA + reducedFirstSpiritualBaseB); // 2A
const reducedSecondSpiritualBaseA = lastReducer(this.secondSpiritualBaseA);
this.secondSpiritualBaseB = this.numberReducer(reducedFirstSpiritualBaseA + reducedFirstSpiritualBaseC); // 2B
this.secondSpiritualBaseC = this.numberReducer(reducedFirstSpiritualBaseB + reducedFirstSpiritualBaseC); // 2C
const reducedSecondSpiritualBaseC = lastReducer(this.secondSpiritualBaseC);
this.thirdSpiritualBaseA = this.numberReducer(reducedSecondSpiritualBaseA + reducedSecondSpiritualBaseC); // 3A
}
getResistanceNumber(numbers) {
if (numbers.length === 0)
return 0;
if (numbers.length === 1)
return numbers[0];
while (numbers.length > 1) {
numbers.sort((a, b) => a - b);
numbers.reverse();
const [first, second, ...rest] = numbers;
const result = this.numberReducer(Math.abs(first - second));
numbers = [result, ...rest];
}
return numbers[0];
}
}
class DiamondProfile extends Base22Profile {
starFacet; // FE
radiationSource; // FR
reflect; // R
keyResource; // RC
diamondSumOptions = {
sumRecursively: true,
stopNumbers: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 26, 30, 33, 40, 44],
};
numberReducer = reduceNumberDigits(this.diamondSumOptions);
constructor({ day, month, year }) {
super({ day, month, year });
// Delegating the presentation of the reduced number to the frontend
// so we're leaving potential numbers above 22
const lastReducer = reduceNumberDigits({
sumRecursively: false,
stopNumbers: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22],
});
this.starFacet = this.numberReducer(this.reducedDay + this.reducedMonth); // FE
const reducedStarFacet = lastReducer(this.starFacet);
const reducedDeepPersonality = lastReducer(this.deepPersonality); // PP
this.radiationSource = this.numberReducer(reducedStarFacet + reducedDeepPersonality); // FR
const reducedRadiationSource = lastReducer(this.radiationSource);
this.reflect = this.numberReducer(this.year % 100); // R
this.keyResource = this.numberReducer(reducedStarFacet + reducedRadiationSource + reducedDeepPersonality + this.reducedYear); // RC
}
}
class PlannerProfile {
consultingYear;
consultingMonth;
day;
// month is 1-based
month;
year;
annualVibration; // VA
universalVibration; // U
personalVibration; // P
// Each one of the 35 cells in a 7 (days) x 5 (weeks) calendar grid, starting on Sunday.
plannerDays;
plannerSumOptions = {
sumRecursively: true,
stopNumbers: [11, 22, 33],
};
numberReducer = reduceNumberDigits(this.plannerSumOptions);
constructor({ day, month, year, consultingYear, consultingMonth }) {
this.consultingYear = consultingYear;
this.consultingMonth = consultingMonth;
this.day = day;
this.month = month;
this.year = year;
const reducedConsultingYear = this.numberReducer(this.consultingYear);
this.annualVibration = this.numberReducer(this.day + this.month + this.consultingYear); // VA
this.universalVibration = this.numberReducer(reducedConsultingYear + this.consultingMonth); // U
this.personalVibration = this.numberReducer(this.annualVibration + this.consultingMonth); // P
const firstDayDate = new Date(this.consultingYear, this.consultingMonth - 1, 1);
const firstWeekDay = firstDayDate.getDay(); // 0 Sunday, 6 Saturday
const gridStartOffset = new Array(firstWeekDay).fill(null);
const plannerCalculatedDays = getDaysInMonth(this.consultingYear, this.consultingMonth - 1).map((calendarDay) => {
const universalDay = this.numberReducer(this.universalVibration + calendarDay);
const personalDay = this.numberReducer(this.personalVibration + calendarDay);
return {
calendarDay,
universalDay,
personalDay,
};
});
const gridEndOffset = new Array(Math.max(35 - (firstWeekDay + plannerCalculatedDays.length), 0)).fill(null);
this.plannerDays = [...gridStartOffset, ...plannerCalculatedDays, ...gridEndOffset];
}
}
export { Base22Profile, DestinyTable, DiamondProfile, EvolutiveProfile, PlannerProfile, PythagoreanPinnacle, PythagoreanProfile, TantricProfile, cleanString, generateExpandedLetterCount, generateExpandedNames, getDaysInMonth, getLetterSumFromString, getLetterSumFromWord, getLetterValue, reduceNumberDigits, repeatArrayElements };