0.2.0 • Published 10 years ago
is-valid-httpmethod v0.2.0
##How to use
Example :
'use strict'
const isValidHttpMethod = require ('is-valid-httpmethod')
isValidHttpMethod('GET') // => true
isValidHttpMethod('get') // => false
isValidHttpMethod(['GET', '/home', '/index']) // => true
//Promise Mode
isValidHttpMethod('GET', true) // => Promise object with Promise_Value set to 'true'##API
function (item[, bool]) => bool | Promise
item : string | ArrayObj
bool : boolean
Return true if item is a string that represents a valid http request method
, like 'GET', or 'POST'. Else false.
If item is an Array object, return true if the first element is a string
that represents a valid http request method, else false.
If bool is set to true (or any values that interpreted to true in
an equality test), return an Promise object with a Promise_Value set
to true or false, depending to the test.