mirror of
https://github.com/typicode/json-server.git
synced 2025-07-27 12:12:41 +08:00
18 lines
246 B
JavaScript
18 lines
246 B
JavaScript
module.exports = {
|
|
JSON: isJSON,
|
|
JS: isJS,
|
|
URL: isURL
|
|
}
|
|
|
|
function isJSON (s) {
|
|
return !isURL(s) && /\.json$/.test(s)
|
|
}
|
|
|
|
function isJS (s) {
|
|
return !isURL(s) && /\.js$/.test(s)
|
|
}
|
|
|
|
function isURL (s) {
|
|
return /^(http|https):/.test(s)
|
|
}
|