Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@solucx/sdk

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solucx/sdk - npm Package Compare versions

Comparing version
2.0.0
to
2.1.0
+11
-18
package.json
{
"name": "@solucx/sdk",
"version": "2.0.0",
"version": "2.1.0",
"description": "SoluCX SDK",

@@ -11,4 +11,3 @@ "main": "build/index.js",

"files": [
"build/**/*",
"src/**/*"
"build/**/*"
],

@@ -28,3 +27,2 @@ "repository": {

"test:cov": "jest --coverage",
"prepare": "npm run build",
"prepublishOnly": "npm run lint",

@@ -37,18 +35,14 @@ "preversion": "npm run lint",

"dependencies": {
"@solucx/indicators": "^1.1.0",
"@solucx/permissions": "^1.0.1",
"jstat": "^1.9.4",
"typescript": "^3.9.3"
"@solucx/indicators": "^1.1.2",
"@solucx/permissions": "^1.1.3",
"jstat": "^1.9.5"
},
"devDependencies": {
"@stryker-mutator/core": "^4.5.1",
"@stryker-mutator/jest-runner": "^4.5.1",
"@types/jest": "^25.2.3",
"jest": "^26.0.1",
"jest-sonar": "^0.2.12",
"prettier": "^2.0.5",
"sonarqube-scanner": "^2.8.1",
"ts-jest": "^26.1.0",
"jest": "^26.6.3",
"prettier": "^2.6.2",
"ts-jest": "^26.5.6",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.7.3"
},

@@ -63,4 +57,3 @@ "jest": {

"reporters": [
"default",
"jest-sonar"
"default"
],

@@ -67,0 +60,0 @@ "modulePaths": [

export enum TargetCondition {
DIFFERENT_THAN = "different_than",
GREATER_THAN = "greater_than",
LESS_THAN = "less_than",
EQUAL = "equal"
}
export enum TargetConditionType {
NPS = "nps",
CSAT = "csat",
CSAT10 = "csat10",
CES = "ces",
NSS = "nss",
CES2 = "ces2",
LD = "ld",
NONE = "none",
TRANSACTIONS_VOLUME = "transactions_volume",
RATINGS_VOLUME = "ratings_volume",
PERFORMANCE = "performance",
SAMPLING_ERROR = "sampling_error"
}
import { TargetConditionType } from "./TargetConditionType";
export const ValueMetricDefinition = {
// indicators keys
[TargetConditionType.NPS]: "value",
[TargetConditionType.CSAT]: "value",
[TargetConditionType.CSAT10]: "value",
[TargetConditionType.CES]: "value",
[TargetConditionType.NSS]: "value",
[TargetConditionType.CES2]: "value",
[TargetConditionType.LD]: "value",
[TargetConditionType.NONE]: "value",
[TargetConditionType.PERFORMANCE]: "value",
// other keys
[TargetConditionType.TRANSACTIONS_VOLUME]: "transactions",
[TargetConditionType.RATINGS_VOLUME]: "ratings",
[TargetConditionType.SAMPLING_ERROR]: "samplingError"
};
import Indicators from "@solucx/indicators";
import { Permissions as Permission, PermissionParser, Levels } from "@solucx/permissions";
import { TargetCondition } from "./Conditions/TargetCondition";
import { TargetConditionType } from "./Conditions/TargetConditionType";
import { ValueMetricDefinition } from "./Conditions/ValueMetricDefinition";
import { TargetPeriod } from "./Periods/TargetPeriod";
export { Indicators, Permission, PermissionParser, TargetCondition, TargetConditionType, ValueMetricDefinition, Levels, TargetPeriod };
import * as jstat from "jstat";
export function confidenceIntervalToZScore(confidenceInterval: number): number {
const cdf = (1 + confidenceInterval / 100) / 2;
return jstat.normal.inv(cdf, 0, 1);
}
export function calcSamplingError(population: number, zScore: number, sampleSize: number) {
const numerator = Math.sqrt((population - sampleSize) * zScore ** 2);
const denominator = Math.sqrt(4 * sampleSize * (population - 1));
return (numerator / denominator) * 100;
}
export function calcSampleSize(population: number, zScore: number, samplingError: number) {
samplingError /= 100;
const numerator = population * zScore ** 2 * 0.25;
const denominator = (population - 1) * samplingError ** 2 + zScore ** 2 * 0.25;
return numerator / denominator;
}
export enum TargetPeriod {
monthly = "monthly",
bimester = "bimester",
trimester = "trimester",
semester = "semester",
annual = "annual"
}
import { calcSampleSize, calcSamplingError, confidenceIntervalToZScore } from "../../Math/Statistics";
describe("Statistics module", () => {
describe("confidenceToZScore", () => {
it("should return 1.96 when confidence interval is 95", () => {
const zScore = confidenceIntervalToZScore(95);
expect(zScore).toBeCloseTo(1.96);
});
it("should return 0 when confidence interval is 0", () => {
const zScore = confidenceIntervalToZScore(0);
expect(zScore).toBeCloseTo(0);
});
it("should return when confidence interval is 95", () => {
const zScore = confidenceIntervalToZScore(99);
expect(zScore).toBeCloseTo(2.58);
});
});
describe("calcSampleSize", () => {
it("should return 49.24 when population=100, samplingError=10, zScore=1.96", () => {
const sampleSize = calcSampleSize(100, 1.96, 10);
expect(sampleSize).toBeCloseTo(49.24);
});
it("should return population when samplingError=0", () => {
const population = 100;
const sampleSize = calcSampleSize(population, 1.96, 0);
expect(sampleSize).toBeCloseTo(population);
});
it("should return 79.51 when population=100, samplingError=5, zScore=1.96", () => {
const sampleSize = calcSampleSize(100, 1.96, 5);
expect(sampleSize).toBeCloseTo(79.51);
});
it("should return 62.7 when population=100, samplingError=10, zScore=2.58", () => {
const sampleSize = calcSampleSize(100, 2.58, 10);
expect(sampleSize).toBeCloseTo(62.7);
});
it("should return 65.1 when population=200, samplingError=10, zScore=1.96", () => {
const sampleSize = calcSampleSize(200, 1.96, 10);
expect(sampleSize).toBeCloseTo(65.1);
});
});
describe("calcSamplingError", () => {
it("should return 10 when population=100, sampleSize=49.24, zScore=1.96", () => {
const samplingError = calcSamplingError(100, 1.96, 49.24);
expect(samplingError).toBeCloseTo(10);
});
it("should return 0 when sampleSize=population and population", () => {
const population = 100;
const samplingError = calcSamplingError(population, 1.96, population);
expect(samplingError).toBeCloseTo(0);
});
it("should return 5 when population=100, samplingSize=79.51, zScore=1.96", () => {
const samplingError = calcSamplingError(100, 1.96, 79.51);
expect(samplingError).toBeCloseTo(5);
});
it("should return 10 when population=100, samplingSize=62.7, zScore=2.58", () => {
const samplingError = calcSamplingError(100, 2.58, 62.7);
expect(samplingError).toBeCloseTo(10);
});
it("should return 10 when population=200, sampleSize=65.1, zScore=1.96", () => {
const samplingError = calcSamplingError(200, 1.96, 65.1);
expect(samplingError).toBeCloseTo(10);
});
});
});