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.5.3 to 1.0.0

built/ssn.d.ts

15

package.json
{
"name": "ssn",
"version": "0.5.3",
"version": "1.0.0",
"description": "Validate and generate fake SSN",
"main": "index.js",
"main": "built/index.js",
"files": [
"built/"
],
"scripts": {
"test": "make test"
"test": "mocha"
},

@@ -26,9 +29,9 @@ "repository": {

"dependencies": {
"sprintf": ">= 0.1.4"
"@types/node": "^6.0.58"
},
"homepage": "https://github.com/winfinit/fake-ssn-node",
"devDependencies": {
"mocha": "^1.21.4",
"chai": "^1.9.1"
"mocha": "^3.2.0",
"chai": "^3.5.0"
}
}

78

README.md

@@ -15,22 +15,13 @@ # fake-ssn-node

## Usage
## Synopsis
```javascript
// Generate SSN from random state
var ssn = require('ssn');
console.log(ssn.generate());
let {ParseSSN, RandomSSN} = require('ssn');
let randomSSN = new RandomSSN();
console.log("SSN string:", randomSSN.value().toString()); //023121234
console.log("SSN formatted string", randomSSN.value().toFormattedString()); //023-12-1234
console.log("SSN state", randomSSN.value().state().toString()); // FL
// Generate SSN from state of FL
console.log(ssn.generate('FL'));
// Validate social security
if ( ssn.validate('420-19-4933') ) {
console.log('valid');
} else {
console.log('invalid');
}
// Get a state where SSN was issued
var state = ssn.validate('420-19-4933');
console.log('420-19-4933 was issued in', state);
let parseSSN = new ParseSSN('516386083');
console.log("SSN state", parseSSN.ssn().state().toString());
```

@@ -44,2 +35,54 @@

## API
### RandomSSN(stateANSI?: string)
Class generates random social security number, optionally accepts state ANSI string (Ex. FL, NY, etc.).
```javascript
let randomSSN = new RandomSSN();
let randomSSNFromState = new RandomSSN('FL');
let ssnString = randomSSN.value().toString();
let stateANSIString = randomSSN.value().state().toString();
```
#### value(): SSN
Method returning generated SSN object
----
### ParseSSN(ssnString: string)
Class parsing SSN string and performs validity of SSN, if SSN is invalid, RangeError exception is thrown.
```javascript
let parseSSN = new ParseSSN('516386083');
let ssnString = parseSSN.value().toString();
```
#### value(): SSN
Method returning generated SSN object
----
### SSN(state: SSNState, ssn: string)
Class with helper methods to deal with SSN string
#### toFormattedString(): string
Returns formatted SSN string 'xxx-xx-xxxx'
#### toString(): string
Returns SSN in a string format 'xxxxxxxxx'
#### state(): SSNState
Returns SSNState object
----
### SSNState(state: string)
Class helping to deal with states in relation to SSN
#### toString(): string
Return ANSI string for state
## Contributing

@@ -59,2 +102,3 @@

* 0.5.3 fixed bug with random states selection
* 1.0.0 rewrite of a module in TS

@@ -61,0 +105,0 @@ ## Legal

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