Skip to content

Commit

Permalink
Use indexOf instead of regex
Browse files Browse the repository at this point in the history
  • Loading branch information
frederickcxa committed May 2, 2018
1 parent 56ab159 commit 788bdf1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/isPublished/README.md
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

Expand Down
7 changes: 3 additions & 4 deletions lib/isPublished/index.js
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;
};

0 comments on commit 788bdf1

Please sign in to comment.