Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ssn

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssn - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

33

index.js

@@ -212,3 +212,3 @@ var sprintf = require('sprintf').sprintf;

exports.generate = function generate(state) {
exports.generate = function (state) {
state = state || states[Math.floor(Math.random() * (states.length - 1))];

@@ -230,1 +230,32 @@ state = state.toUpperCase().trim();;

exports.validate = function (ssn) {
ssn = ssn.replace(/-/g,'');
if( ssn.length !== 9 ) {
console.log('invalid length');
return false;
}
if( isNaN(ssn) ) {
console.log('not a number');
return false;
}
var area_number = ssn.substr(0, 3);
var group_number = ssn.substr(3,2);
var last_four = ssn.substr(5);
area_number = Number(area_number);
group_number = Number(group_number);
last_four = Number(last_four);
for( var state in statePrefixes ) {
if ( statePrefixes[state].indexOf(area_number) !== -1 ) {
if ( possibleGroups.indexOf(highgroup[area_number]) >= possibleGroups.indexOf(group_number) ) {
return state;
} else {
return false;
}
}
}
return false;
}

2

package.json
{
"name": "ssn",
"version": "0.0.3",
"version": "0.0.4",
"description": "Validate and generate fake SSN",

@@ -5,0 +5,0 @@ "main": "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