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

@thomaschaplin/cusip-generator

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thomaschaplin/cusip-generator - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

build/__tests__/generate-cusip-check-code.spec.d.ts

13

build/__tests__/convert-string-to-base-ten-number.spec.js

@@ -41,14 +41,11 @@ "use strict";

var convert_string_to_base_ten_number_1 = require("../convert-string-to-base-ten-number");
describe("convertStringToNumberToBaseTen", function () {
it("should convert string into base ten number", function () {
var result = convert_string_to_base_ten_number_1.convertStringToNumberToBaseTen("1");
describe("convert-string-to-base-ten-number", function () {
it("should convert string to base ten number", function () {
var result = convert_string_to_base_ten_number_1.convertStringToBaseTenNumber("1");
expect(result).toStrictEqual(1);
});
it("performance", function () { return __awaiter(void 0, void 0, void 0, function () {
it("convert-string-to-base-ten-number performance", function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, kelonio_1.benchmark.record([
"convertStringToNumberToBaseTen",
"should convert string into base ten number",
], function () { return convert_string_to_base_ten_number_1.convertStringToNumberToBaseTen("1"); }, { meanUnder: 1 })];
case 0: return [4 /*yield*/, kelonio_1.benchmark.record("convert-string-to-base-ten-number", function () { return convert_string_to_base_ten_number_1.convertStringToBaseTenNumber("1"); }, { meanUnder: 1 })];
case 1:

@@ -55,0 +52,0 @@ _a.sent();

@@ -1,1 +0,1 @@

export declare const convertStringToNumberToBaseTen: (value: string) => number;
export declare const convertStringToBaseTenNumber: (value: string) => number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertStringToNumberToBaseTen = void 0;
exports.convertStringToNumberToBaseTen = function (value) {
exports.convertStringToBaseTenNumber = void 0;
var convertStringToBaseTenNumber = function (value) {
return parseInt(value, 10);
};
exports.convertStringToBaseTenNumber = convertStringToBaseTenNumber;
//# sourceMappingURL=convert-string-to-base-ten-number.js.map
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.alphanumeric = void 0;
exports.alphanumeric = [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"J",
"K",
"L",
"M",
"N",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
];
var alphabet_1 = require("./alphabet");
var base_ten_numbers_1 = require("./base-ten-numbers");
exports.alphanumeric = __spreadArray(__spreadArray([], __read(alphabet_1.alphabet)), __read(base_ten_numbers_1.baseTenNumbers));
//# sourceMappingURL=alphanumeric-values.js.map

@@ -1,1 +0,1 @@

export declare const calculateCheckCode: (cusip: string) => number;
export declare const generateCusipCheckCode: (cusip: string) => number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateCheckCode = void 0;
exports.generateCusipCheckCode = void 0;
var convert_string_to_base_ten_number_1 = require("./convert-string-to-base-ten-number");
var is_odd_1 = require("./is-odd");
exports.calculateCheckCode = function (cusip) {
var generateCusipCheckCode = function (cusip) {
var cusipLength = cusip.length;

@@ -13,3 +13,3 @@ var currentValue;

currentValue = cusip[i];
var currentNumberToBaseTen = convert_string_to_base_ten_number_1.convertStringToNumberToBaseTen(currentValue);
var currentNumberToBaseTen = convert_string_to_base_ten_number_1.convertStringToBaseTenNumber(currentValue);
var currentNumberOrPosition = isNaN(currentNumberToBaseTen)

@@ -27,2 +27,3 @@ ? currentValue.charCodeAt(0) - "A".charCodeAt(0) + 10

};
exports.generateCusipCheckCode = generateCusipCheckCode;
//# sourceMappingURL=generate-cusip-check-code.js.map

@@ -1,1 +0,1 @@

export declare const makeCusipWithoutCheckCode: () => string;
export declare const generateCusipWithoutCheckCode: () => string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeCusipWithoutCheckCode = void 0;
exports.generateCusipWithoutCheckCode = void 0;
var generate_random_string_of_alphanumeric_chars_1 = require("./generate-random-string-of-alphanumeric-chars");
var generate_random_string_of_base_ten_chars_1 = require("./generate-random-string-of-base-ten-chars");
exports.makeCusipWithoutCheckCode = function () {
var generateCusipWithoutCheckCode = function () {
var randomBaseTenString = generate_random_string_of_base_ten_chars_1.generateRandomStringOfBaseTenChars();

@@ -11,2 +11,3 @@ var randomAlphanumericString = generate_random_string_of_alphanumeric_chars_1.generateRandomStringOfAlphanumericChars();

};
exports.generateCusipWithoutCheckCode = generateCusipWithoutCheckCode;
//# sourceMappingURL=generate-cusip-without-check-code.js.map

@@ -6,7 +6,8 @@ "use strict";

var generate_cusip_without_check_code_1 = require("./generate-cusip-without-check-code");
exports.generateCusip = function () {
var cusip = generate_cusip_without_check_code_1.makeCusipWithoutCheckCode();
var check = generate_cusip_check_code_1.calculateCheckCode(cusip);
var generateCusip = function () {
var cusip = generate_cusip_without_check_code_1.generateCusipWithoutCheckCode();
var check = generate_cusip_check_code_1.generateCusipCheckCode(cusip);
return cusip + check;
};
exports.generateCusip = generateCusip;
//# sourceMappingURL=generate-cusip.js.map

@@ -1,1 +0,1 @@

export declare const getRandomAlphanumeric: () => string | number;
export declare const generateRandomAlphanumeric: () => string | number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRandomAlphanumeric = void 0;
exports.generateRandomAlphanumeric = void 0;
var alphanumeric_values_1 = require("./fixtures/alphanumeric-values");
exports.getRandomAlphanumeric = function () {
var generateRandomAlphanumeric = function () {
return alphanumeric_values_1.alphanumeric[Math.floor(Math.random() * alphanumeric_values_1.alphanumeric.length)];
};
exports.generateRandomAlphanumeric = generateRandomAlphanumeric;
//# sourceMappingURL=generate-random-alphanumeric.js.map

@@ -1,1 +0,1 @@

export declare const getRandomBaseTenNumber: () => number;
export declare const generateRandomBaseTenNumber: () => number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRandomBaseTenNumber = void 0;
exports.getRandomBaseTenNumber = function () {
exports.generateRandomBaseTenNumber = void 0;
var generateRandomBaseTenNumber = function () {
return Math.floor(Math.random() * 10);
};
exports.generateRandomBaseTenNumber = generateRandomBaseTenNumber;
//# sourceMappingURL=generate-random-base-ten-number.js.map

@@ -5,9 +5,10 @@ "use strict";

var generate_random_alphanumeric_1 = require("./generate-random-alphanumeric");
exports.generateRandomStringOfAlphanumericChars = function () {
var generateRandomStringOfAlphanumericChars = function () {
var string = "";
for (var i = 0; i < 2; i++) {
string = string + generate_random_alphanumeric_1.getRandomAlphanumeric();
string = string + generate_random_alphanumeric_1.generateRandomAlphanumeric();
}
return string;
};
exports.generateRandomStringOfAlphanumericChars = generateRandomStringOfAlphanumericChars;
//# sourceMappingURL=generate-random-string-of-alphanumeric-chars.js.map

@@ -5,9 +5,10 @@ "use strict";

var generate_random_base_ten_number_1 = require("./generate-random-base-ten-number");
exports.generateRandomStringOfBaseTenChars = function () {
var generateRandomStringOfBaseTenChars = function () {
var string = "";
for (var i = 0; i < 6; i++) {
string = string + generate_random_base_ten_number_1.getRandomBaseTenNumber();
string = string + generate_random_base_ten_number_1.generateRandomBaseTenNumber();
}
return string;
};
exports.generateRandomStringOfBaseTenChars = generateRandomStringOfBaseTenChars;
//# sourceMappingURL=generate-random-string-of-base-ten-chars.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateCusip = void 0;
var generate_cusip_1 = require("./generate-cusip");
Object.defineProperty(exports, "generateCusip", { enumerable: true, get: function () { return generate_cusip_1.generateCusip; } });
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isOdd = void 0;
exports.isOdd = function (value) { return value % 2 === 1; };
var isOdd = function (value) { return value % 2 === 1; };
exports.isOdd = isOdd;
//# sourceMappingURL=is-odd.js.map
{
"name": "@thomaschaplin/cusip-generator",
"version": "1.0.6",
"version": "1.0.7",
"description": "Generate a valid CUSIP",

@@ -13,7 +13,7 @@ "main": "build/index.js",

"scripts": {
"test": "jest",
"test:coverage": "jest --coverage",
"build": "rimraf ./build && tsc",
"watch": "rimraf ./build && tsc --watch",
"start": "node build/index.js"
"test": "jest --runInBand",
"test:coverage": "rm -rf coverage && npm test -- --coverage",
"test:mutation": "stryker run",
"build": "rm -rf ./build && tsc",
"watch": "npm run build -- --watch"
},

@@ -37,11 +37,13 @@ "repository": {

"devDependencies": {
"@types/jest": "^24.9.1",
"@types/node": "^12.20.4",
"husky": "^4.3.8",
"jest": "^26.6.3",
"kelonio": "^0.6.0",
"rimraf": "^3.0.2",
"ts-jest": "^24.3.0",
"typescript": "^3.9.9"
"ts-jest": "^26.5.3",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.31",
"husky": "^5.1.3",
"typescript": "^4.2.3",
"@stryker-mutator/core": "^4.4.1",
"@stryker-mutator/jest-runner": "^4.4.1",
"@stryker-mutator/typescript-checker": "^4.4.1"
}
}

@@ -57,3 +57,3 @@ <img src="assets/logo.png" alt="logo" width="201" height="245" />

- Run the tests `npm test`
- Run the tests with coverage `npm test:coverage`
- Run the tests with coverage `npm run test:coverage`

@@ -60,0 +60,0 @@ ## License

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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