parse-ssn
Advanced tools
Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "parse-ssn", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Tiny utils to handle formatting, masking, and validating of US Social Security numbers.", | ||
@@ -17,4 +17,4 @@ "source": "index.ts", | ||
"test": "ava test.ts", | ||
"format": "prettier-standard ./*.ts --format", | ||
"lint": "prettier-standard ./*.ts" | ||
"format": "prettier-standard --format", | ||
"lint": "prettier-standard --lint" | ||
}, | ||
@@ -21,0 +21,0 @@ "husky": { |
@@ -6,3 +6,3 @@ # parse-ssn ![npm](https://img.shields.io/npm/v/parse-ssn) [![](https://badgen.net/bundlephobia/minzip/parse-ssn)](https://bundlephobia.com/result?p=parse-ssn) | ||
```bash | ||
npm i parse-ssn --save | ||
npm i parse-ssn | ||
``` | ||
@@ -15,6 +15,6 @@ | ||
```javascript | ||
import { mask } from "parse-ssn"; | ||
import { mask } from 'parse-ssn' | ||
format("123121234"); // => *****1234 | ||
format("123121234", "#"); // => #####1234 | ||
mask('123121234') // => *****1234 | ||
mask('123121234', '#') // => #####1234 | ||
``` | ||
@@ -25,6 +25,6 @@ | ||
```javascript | ||
import { format } from "parse-ssn"; | ||
import { format } from 'parse-ssn' | ||
format("123121234"); // => 123-12-1234 | ||
format("123121234", " "); // => 123 12 1234 | ||
format('123121234') // => 123-12-1234 | ||
format('123121234', ' ') // => 123 12 1234 | ||
``` | ||
@@ -35,15 +35,15 @@ | ||
```javascript | ||
import { format, mask } from "parse-ssn"; | ||
import { format, mask } from 'parse-ssn' | ||
const masked = mask("123121234"); // => *****1234 | ||
const formatted = format(masked); // => ***-**-1234 | ||
const masked = mask('123121234') // => *****1234 | ||
const formatted = format(masked) // => ***-**-1234 | ||
``` | ||
When dealing with formatting of masks that use a placeholder other than `*`, you | ||
need to pass additional information about the format. | ||
When dealing with formatting of masks that use an existing placeholder other | ||
than `*`, you need to pass additional information about the format. | ||
```javascript | ||
import { format } from "parse-ssn"; | ||
import { format } from 'parse-ssn' | ||
format("#####1234", "-", "#"); // => ###-##-1234 | ||
format('#####1234', '-', '#') // => ###-##-1234 | ||
``` | ||
@@ -58,5 +58,5 @@ | ||
```javascript | ||
import { validate } from "parse-ssn"; | ||
import { validate } from 'parse-ssn' | ||
validate("123121234"); // => true | ||
validate('123121234') // => true | ||
``` | ||
@@ -67,10 +67,11 @@ | ||
By default, `clean` strips out all characters _except_ numbers, _and_ trims the | ||
string to nine characters. | ||
string to nine characters. You probably want to use this first before `mask` or | ||
`format`. | ||
```javascript | ||
import { clean } from "parse-ssn"; | ||
import { clean } from 'parse-ssn' | ||
clean("123-12-1234") // => 123121234 | ||
clean(" 123 12-1234") // => 123121234 | ||
clean("123-12-1234-12345") // => 123121234 | ||
clean('123-12-1234') // => 123121234 | ||
clean(' 123 12-1234') // => 123121234 | ||
clean('123-12-1234-12345') // => 123121234 | ||
``` | ||
@@ -81,5 +82,5 @@ | ||
```javascript | ||
import { clean } from "parse-ssn"; | ||
import { clean } from 'parse-ssn' | ||
clean("*****1234", "*") // => *****1234 | ||
clean('*****1234', '*') // => *****1234 | ||
``` | ||
@@ -86,0 +87,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
84
12014
1