Nitrogen Pumpkin Mulch

    @fossbarrow/swedish-ssn-validator

    1.0.0 • Public • Published

    Swedish SSN Validator

    MIT Licensed

    Validate and mask functionality for an Swedish Social Security Number (SSN).

    Installation

    Install the package via npm:

    npm install @fossbarrow/swedish-ssn-validator@1.0.0 --save

    Usage

    ssnIsValid(value)

    This method validates if the given value is a valid Social Security Number.

    Input

    string matching 10 or 12 words in length. Dashes and colons are ignored to the length count.

    Example

    ssnIsValid({});
    // => false
    
    ssnIsValid('011-23-4567');
    // => false
    
    ssnIsValid('011234567');
    // => false
    
    ssnIsValid('1990-11-21:1234');
    // => True
    
    ssnIsValid('199011211234');
    // => True
    
    ssnIsValid('9011211234');
    // => True
    
    ssnIsValid('90-11-21:1234');
    // => True

    mask(value)

    This method will help you protect the SSN from sensitive information by obfuscating some digits.

    The ssn key for day of birth and gender is left unmasked.

    Example

    ssnMask({});
    // => Throws an Error.
    
    ssnMask('900211-1234')
    // => XXXX11XX3X
    
    ssnMask('19900211-1234')
    // => XXXXXX11XX3X
    
    ssnMask('12345678912');
    // => Throws an Error.

    Changelog

    Please see CHANGELOG for more information on what has changed recently.

    Credits

    License

    The MIT License (MIT). Please see License File for more information.

    Install

    npm i @fossbarrow/swedish-ssn-validator

    DownloadsWeekly Downloads

    4

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    6.29 kB

    Total Files

    6

    Last publish

    Collaborators

    • patricnox