Socket
Socket
Sign inDemoInstall

format-utils

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.6 to 0.0.7

.husky/commit-msg

1

.prettierrc.js
module.exports = {
trailingComma: 'all',
singleQuote: true,
printWidth: 120
};

@@ -5,2 +5,4 @@ # Changelog

### [0.0.7](https://github.com/mastermunj/format-utils/compare/v0.0.6...v0.0.7) (2021-09-04)
### [0.0.6](https://github.com/mastermunj/format-utils/compare/v0.0.5...v0.0.6) (2021-03-22)

@@ -7,0 +9,0 @@

4

dist/verhoeff.js

@@ -6,5 +6,3 @@ "use strict";

static validate(value) {
const digits = [...value.replace(/\s/g, '')]
.reverse()
.map((digit) => parseInt(digit, 10));
const digits = [...value.replace(/\s/g, '')].reverse().map((digit) => parseInt(digit, 10));
const checksum = digits.reduce((prev, current, index) => {

@@ -11,0 +9,0 @@ return Verhoeff.multiplication[prev][Verhoeff.permutation[index % 8][current]];

@@ -18,5 +18,3 @@ "use strict";

const defaultHandles = VPA.getDefaultVpaHandles();
options.handles = (options.handles === true
? defaultHandles
: [...options.handles, ...defaultHandles]);
options.handles = (options.handles === true ? defaultHandles : [...options.handles, ...defaultHandles]);
const handle = value.split('@')[1];

@@ -23,0 +21,0 @@ isValidFormat = options.handles.indexOf(handle) >= 0;

@@ -9,6 +9,3 @@ module.exports = {

roots: ['<rootDir>'],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/?(*.)+(spec|test).+(ts|tsx|js)',
],
testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'],
transform: {

@@ -15,0 +12,0 @@ '^.+\\.(ts|tsx)$': 'ts-jest',

{
"name": "format-utils",
"version": "0.0.6",
"version": "0.0.7",
"description": "Utilities for validating various formats of Indian system codes like Mobile, PAN, AADHAAR, GST and more!",

@@ -45,37 +45,34 @@ "keywords": [

"test": "jest --detectOpenHandles --coverage",
"test:watch": "npm run test -- --watch"
"test:watch": "npm run test -- --watch",
"prepare": "husky install",
"commit": "git-cz"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"lint-staged": {
"package.json": [
"sort-package-json"
]
},
"devDependencies": {
"@commitlint/cli": "^12.0.0",
"@commitlint/config-conventional": "^12.0.0",
"@types/jest": "^26.0.0",
"@types/node": "^14.0.1",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.10",
"@typescript-eslint/eslint-plugin": "^4.30.0",
"@typescript-eslint/parser": "^4.30.0",
"cpy-cli": "^3.1.1",
"eslint": "^7.3.1",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-jest": "^24.0.0",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^5.0.9",
"jest": "^26.0.1",
"lint-staged": "^10.5.2",
"prettier": "^2.0.5",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.2",
"jest": "^27.1.0",
"lint-staged": "^11.1.2",
"prettier": "^2.3.2",
"rimraf": "^3.0.2",
"sort-package-json": "^1.42.1",
"standard-version": "^9.0.0",
"ts-jest": "^26.1.0",
"typescript": "^4.0.2"
"sort-package-json": "^1.50.0",
"standard-version": "^9.3.1",
"ts-jest": "^27.0.5",
"typescript": "^4.4.2"
}
}

@@ -29,10 +29,6 @@ export class Verhoeff {

static validate(value: string): boolean {
const digits = [...value.replace(/\s/g, '')]
.reverse()
.map((digit) => parseInt(digit, 10));
const digits = [...value.replace(/\s/g, '')].reverse().map((digit) => parseInt(digit, 10));
const checksum = digits.reduce((prev, current, index) => {
return Verhoeff.multiplication[prev][
Verhoeff.permutation[index % 8][current]
];
return Verhoeff.multiplication[prev][Verhoeff.permutation[index % 8][current]];
}, 0);

@@ -39,0 +35,0 @@

@@ -18,4 +18,3 @@ export type VpaValidationOptions = {

const regex = /^[a-z0-9_.-]{3,}@[a-z]{3,}$/i;
let isValidFormat =
regex.test(value) && value.length <= (options.maxLength as number);
let isValidFormat = regex.test(value) && value.length <= (options.maxLength as number);
if (!isValidFormat) {

@@ -27,5 +26,5 @@ return false;

const defaultHandles = VPA.getDefaultVpaHandles();
options.handles = (options.handles === true
? defaultHandles
: [...options.handles, ...defaultHandles]) as string[];
options.handles = (
options.handles === true ? defaultHandles : [...options.handles, ...defaultHandles]
) as string[];
const handle = value.split('@')[1];

@@ -32,0 +31,0 @@ isValidFormat = options.handles.indexOf(handle) >= 0;

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc