New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@equisoft/tax-ca

Package Overview
Dependencies
Maintainers
0
Versions
365
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equisoft/tax-ca - npm Package Compare versions

Comparing version 2025.1.0 to 2025.1.1-snapshot.20250107214848

90

dist/pension/canada-pension-plan.js

@@ -16,16 +16,18 @@ "use strict";

exports.CPP = {
CONTRIBUTIONS: {
PENSIONABLE_EARNINGS: {
MAX: 71300,
MIN: 3500,
// Average YMPE of the last 5 year (including current year)
AVG_MAX: 66580,
// Year's additional maximum pensionable earnings (YAMPE)
SUP_MAX: 81200,
},
RATES: {
BASE: 0.0595,
ENHANCEMENT_STEP_2: 0.04,
},
PENSIONABLE_EARNINGS: {
BASIC_EXEMPTION: 3500,
// Year's maximum pensionable earnings (YMPE)
YMPE: 71300,
// Average YMPE of the last 5 year (including current year)
YMPE_AVG_5: 66580,
// Year's additional maximum pensionable earnings (YAMPE)
YAMPE: 81200,
// Year's additional maximum pensionable earnings (YAMPE) of the last 5 year (including current year)
// YAMPE * 0.942 (Temporary factor suggested by Martin Dupras, used to estimate until we have the right value)
YAMPE_AVG_5: 76490,
},
CONTRIBUTION_RATES: {
BASE: 0.0595,
ENHANCEMENT_STEP_2: 0.04,
},
DEATH_BENEFIT: { RATE: 0.5 },

@@ -45,33 +47,2 @@ DEFAULT_REFERENCE_AGE: 65,

},
getRequestDateFactor(birthDate, requestDate, customReferenceDate) {
const { BONUS, PENALTY } = this.MONTHLY_DELAY;
const minRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MIN_REQUEST_AGE);
const maxRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MAX_REQUEST_AGE);
const referenceDate = customReferenceDate || (0, date_1.addYearsToDate)(birthDate, this.DEFAULT_REFERENCE_AGE);
const monthsToToday = (0, date_1.getMonthsDiff)(birthDate, (0, date_1.now)());
const monthsToMinRequestDate = (0, date_1.getMonthsDiff)(birthDate, minRequestDate);
const monthsToMaxRequestDate = (0, date_1.getMonthsDiff)(birthDate, maxRequestDate);
const monthsToReferenceDate = (0, date_1.getMonthsDiff)(birthDate, referenceDate);
const monthsToRequestDate = (0, date_1.getMonthsDiff)(birthDate, requestDate);
const monthsToLastBirthDay = monthsToToday - (monthsToToday % 12);
// Request date is before minimum request date
if (monthsToRequestDate < monthsToMinRequestDate) {
return 0;
}
// Analysis date is after the maximum request date
if (monthsToMaxRequestDate < monthsToToday) {
return 1;
}
// Analysis date is after reference date and request date is before last birthday
if (monthsToToday > monthsToReferenceDate && monthsToRequestDate < monthsToLastBirthDay) {
return 1;
}
let monthsDelta = (0, math_1.clamp)(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
monthsDelta -= Math.max(monthsToLastBirthDay, monthsToReferenceDate);
return 1 + (monthsDelta * (monthsDelta >= 0 ? BONUS : PENALTY));
},
getAverageIndexationRate() {
const sum = this.INDEXATION_RATE_REFERENCES.reduce((previous, current) => previous + current[1], 0);
return (0, math_1.roundToPrecision)(sum / this.INDEXATION_RATE_REFERENCES.length, 3);
},
INDEXATION_RATE_REFERENCES: [

@@ -176,2 +147,33 @@ [2007, 0.020],

YEARS_TO_FULL_PENSION: 40,
getRequestDateFactor(birthDate, requestDate, customReferenceDate) {
const { BONUS, PENALTY } = this.MONTHLY_DELAY;
const minRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MIN_REQUEST_AGE);
const maxRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MAX_REQUEST_AGE);
const referenceDate = customReferenceDate || (0, date_1.addYearsToDate)(birthDate, this.DEFAULT_REFERENCE_AGE);
const monthsToToday = (0, date_1.getMonthsDiff)(birthDate, (0, date_1.now)());
const monthsToMinRequestDate = (0, date_1.getMonthsDiff)(birthDate, minRequestDate);
const monthsToMaxRequestDate = (0, date_1.getMonthsDiff)(birthDate, maxRequestDate);
const monthsToReferenceDate = (0, date_1.getMonthsDiff)(birthDate, referenceDate);
const monthsToRequestDate = (0, date_1.getMonthsDiff)(birthDate, requestDate);
const monthsToLastBirthDay = monthsToToday - (monthsToToday % 12);
// Request date is before minimum request date
if (monthsToRequestDate < monthsToMinRequestDate) {
return 0;
}
// Analysis date is after the maximum request date
if (monthsToMaxRequestDate < monthsToToday) {
return 1;
}
// Analysis date is after reference date and request date is before last birthday
if (monthsToToday > monthsToReferenceDate && monthsToRequestDate < monthsToLastBirthDay) {
return 1;
}
let monthsDelta = (0, math_1.clamp)(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
monthsDelta -= Math.max(monthsToLastBirthDay, monthsToReferenceDate);
return 1 + (monthsDelta * (monthsDelta >= 0 ? BONUS : PENALTY));
},
getAverageIndexationRate() {
const sum = this.INDEXATION_RATE_REFERENCES.reduce((previous, current) => previous + current[1], 0);
return (0, math_1.roundToPrecision)(sum / this.INDEXATION_RATE_REFERENCES.length, 3);
},
};

@@ -7,15 +7,12 @@ export interface Factor {

export interface PensionableEarnings {
MAX: number;
MIN: number;
AVG_MAX: number;
SUP_MAX: number;
BASIC_EXEMPTION: number;
YMPE: number;
YMPE_AVG_5: number;
YAMPE: number;
YAMPE_AVG_5: number;
}
export interface Rates {
export interface ContributionRates {
BASE: number;
ENHANCEMENT_STEP_2: number;
}
export interface Contributions {
PENSIONABLE_EARNINGS: PensionableEarnings;
RATES: Rates;
}
export interface DeathBenefit {

@@ -49,3 +46,4 @@ RATE: number;

export interface PublicPensionPlan {
CONTRIBUTIONS: Contributions;
PENSIONABLE_EARNINGS: PensionableEarnings;
CONTRIBUTION_RATES: ContributionRates;
DEATH_BENEFIT: DeathBenefit;

@@ -52,0 +50,0 @@ DEFAULT_REFERENCE_AGE: number;

@@ -14,16 +14,18 @@ "use strict";

exports.QPP = {
CONTRIBUTIONS: {
PENSIONABLE_EARNINGS: {
MAX: 71300,
MIN: 3500,
// Average YMPE of the last 5 year (including current year)
AVG_MAX: 66580,
// Year's additional maximum pensionable earnings (YAMPE)
SUP_MAX: 81200,
},
RATES: {
BASE: 0.064,
ENHANCEMENT_STEP_2: 0.04,
},
PENSIONABLE_EARNINGS: {
BASIC_EXEMPTION: 3500,
// Year's maximum pensionable earnings (YMPE)
YMPE: 71300,
// Average YMPE of the last 5 year (including current year)
YMPE_AVG_5: 66580,
// Year's additional maximum pensionable earnings (YAMPE)
YAMPE: 81200,
// Year's additional maximum pensionable earnings (YAMPE) of the last 5 year (including current year)
// YAMPE * 0.942 (Temporary factor suggested by Martin Dupras, used to estimate until we have the right value)
YAMPE_AVG_5: 76490,
},
CONTRIBUTION_RATES: {
BASE: 0.064,
ENHANCEMENT_STEP_2: 0.04,
},
DEATH_BENEFIT: { RATE: 0.5 },

@@ -43,33 +45,2 @@ DEFAULT_REFERENCE_AGE: 65,

},
getRequestDateFactor(birthDate, requestDate, customReferenceDate) {
const { BONUS, PENALTY } = this.MONTHLY_DELAY;
const minRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MIN_REQUEST_AGE);
const maxRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MAX_REQUEST_AGE);
const referenceDate = customReferenceDate || (0, date_1.addYearsToDate)(birthDate, this.DEFAULT_REFERENCE_AGE);
const monthsToToday = (0, date_1.getMonthsDiff)(birthDate, (0, date_1.now)());
const monthsToMinRequestDate = (0, date_1.getMonthsDiff)(birthDate, minRequestDate);
const monthsToMaxRequestDate = (0, date_1.getMonthsDiff)(birthDate, maxRequestDate);
const monthsToReferenceDate = (0, date_1.getMonthsDiff)(birthDate, referenceDate);
const monthsToRequestDate = (0, date_1.getMonthsDiff)(birthDate, requestDate);
const monthsToLastBirthDay = monthsToToday - (monthsToToday % 12);
// Request date is before minimum request date
if (monthsToRequestDate < monthsToMinRequestDate) {
return 0;
}
// Analysis date is after the maximum request date
if (monthsToMaxRequestDate < monthsToToday) {
return 1;
}
// Analysis date is after reference date and request date is before last birthday
if (monthsToToday > monthsToReferenceDate && monthsToRequestDate < monthsToLastBirthDay) {
return 1;
}
let monthsDelta = (0, math_1.clamp)(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
monthsDelta -= Math.max(monthsToLastBirthDay, monthsToReferenceDate);
return 1 + (monthsDelta * (monthsDelta >= 0 ? BONUS : PENALTY));
},
getAverageIndexationRate() {
const sum = this.INDEXATION_RATE_REFERENCES.reduce((previous, current) => previous + current[1], 0);
return (0, math_1.roundToPrecision)(sum / this.INDEXATION_RATE_REFERENCES.length, 2);
},
INDEXATION_RATE_REFERENCES: [

@@ -176,2 +147,33 @@ [2007, 0.021],

YEARS_TO_FULL_PENSION: 40,
getRequestDateFactor(birthDate, requestDate, customReferenceDate) {
const { BONUS, PENALTY } = this.MONTHLY_DELAY;
const minRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MIN_REQUEST_AGE);
const maxRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MAX_REQUEST_AGE);
const referenceDate = customReferenceDate || (0, date_1.addYearsToDate)(birthDate, this.DEFAULT_REFERENCE_AGE);
const monthsToToday = (0, date_1.getMonthsDiff)(birthDate, (0, date_1.now)());
const monthsToMinRequestDate = (0, date_1.getMonthsDiff)(birthDate, minRequestDate);
const monthsToMaxRequestDate = (0, date_1.getMonthsDiff)(birthDate, maxRequestDate);
const monthsToReferenceDate = (0, date_1.getMonthsDiff)(birthDate, referenceDate);
const monthsToRequestDate = (0, date_1.getMonthsDiff)(birthDate, requestDate);
const monthsToLastBirthDay = monthsToToday - (monthsToToday % 12);
// Request date is before minimum request date
if (monthsToRequestDate < monthsToMinRequestDate) {
return 0;
}
// Analysis date is after the maximum request date
if (monthsToMaxRequestDate < monthsToToday) {
return 1;
}
// Analysis date is after reference date and request date is before last birthday
if (monthsToToday > monthsToReferenceDate && monthsToRequestDate < monthsToLastBirthDay) {
return 1;
}
let monthsDelta = (0, math_1.clamp)(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
monthsDelta -= Math.max(monthsToLastBirthDay, monthsToReferenceDate);
return 1 + (monthsDelta * (monthsDelta >= 0 ? BONUS : PENALTY));
},
getAverageIndexationRate() {
const sum = this.INDEXATION_RATE_REFERENCES.reduce((previous, current) => previous + current[1], 0);
return (0, math_1.roundToPrecision)(sum / this.INDEXATION_RATE_REFERENCES.length, 2);
},
};
{
"name": "@equisoft/tax-ca",
"version": "2025.1.0",
"version": "2025.1.1-snapshot.20250107214848",
"description": "Canadian tax data and calculation functions.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc