JSPM

parse-otp-message

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q53411F
  • License MIT

Parses OTP messages for a verification code and service provider.

Package Exports

  • parse-otp-message

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parse-otp-message) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

parse-otp-message

Parses OTP messages for a verification code and service provider.

NPM Build Status JavaScript Style Guide

  • handles hundreds of known services (wechat, google, facebook, whatsapp, uber, twitter, etc...)
  • thorough test suite
  • meant for parsing automated sms messages

Install

npm install --save parse-otp-message

Usage

const parse = require('parse-otp-message')

const result = parse('Use 5677 as Microsoft account security code')

// result.code = '5677
// result.service = 'microsoft'

See the test suite for more examples of the types of messages this module can parse.

API

parse(message)

Returns: Object

Parses the given message and returns an object containing two fields, code and service. The auth code will be all digits except in some special cases, and the returned service will always be lowercase.

If no code or service is found, undefined is returned.

message

Type: String Required

SMS or email message possibly containing an auth code and/or service provider details.

License

MIT © Travis Fischer