-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56ab159
commit 788bdf1
Showing
2 changed files
with
4 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
### isPublished | ||
|
||
Check if the uri ends with '@published' | ||
Check if '@published' is in the uri | ||
|
||
#### Params | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
'use strict'; | ||
|
||
const isUriStringCheck = require('../strCheck'), | ||
validationRegex = /.+@published$/; | ||
const isUriStringCheck = require('../strCheck'); | ||
|
||
/** | ||
* First test if argument is a String. If true, test if the string ends with '@published'. | ||
* First test if argument is a String. If true, test if '@published' is in the string. | ||
* Otherwise, throw an error. | ||
* @param {string} uri | ||
* @return {Boolean} | ||
*/ | ||
module.exports = function (uri) { | ||
isUriStringCheck.strCheck(uri); | ||
return validationRegex.test(uri); | ||
return uri.indexOf('@published') !== -1; | ||
}; |