mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 04:32:24 +08:00
Refactor CLI and add tests
This commit is contained in:
17
src/cli/utils/is.js
Normal file
17
src/cli/utils/is.js
Normal file
@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
JSON: isJSON,
|
||||
JS: isJS,
|
||||
URL: isURL
|
||||
}
|
||||
|
||||
function isJSON (s) {
|
||||
return /\.json$/.test(s)
|
||||
}
|
||||
|
||||
function isJS (s) {
|
||||
return /\.js$/.test(s)
|
||||
}
|
||||
|
||||
function isURL (s) {
|
||||
return /^(http|https):/.test(s)
|
||||
}
|
Reference in New Issue
Block a user