is-mac-address

1.0.4 • Public • Published

is-mac-address

Check if provided string is valid mac address

Installation

Install with npm:

$ npm install is-mac-address --save

Usage

var MAC_ADDRESS = require('is-mac-address')
 
MAC_ADDRESS.isMACAddress('invalid-str')
// => false
 
MAC_ADDRESS.isMACAddress('10:10:10:10:11:09')
// => true
 
MAC_ADDRESS.isMACAddress([])
// => throws TypeError
 

Clone the repo

$ git clone https://github.com/luthraG/is-mac-address.git

API

isMACAddress(str)

Given a mac address this API checks if it is valid mac address or not

It throws

  1. TypeError if str is not provided or if provided but not of type String

Example

var MAC_ADDRESS = require('is-mac-address')
 
MAC_ADDRESS.isMACAddress('invalid-str')
// => false
 
MAC_ADDRESS.isMACAddress('10:09:07:06:03:01')
// => true
 
MAC_ADDRESS.isMACAddress([])
// => throws TypeError
 
 

Author

Gaurav Luthra

License

MIT © Gaurav Luthra

Package Sidebar

Install

npm i is-mac-address

Weekly Downloads

803

Version

1.0.4

License

MIT

Last publish

Collaborators

  • gluthra