Skip to content

Commit

Permalink
Chore: Remove same-origin dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarvaje committed Mar 22, 2018
1 parent 1000c13 commit 27f8453
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/rule-disown-opener/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
},
"dependencies": {
"caniuse-api": "^2.0.0",
"pluralize": "^7.0.0",
"same-origin": "^0.1.1"
"pluralize": "^7.0.0"
},
"description": "sonarwhal rule that checks if external links disown the opener",
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/rule-disown-opener/src/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import { URL } from 'url';

import { isSupported } from 'caniuse-api';
import * as pluralize from 'pluralize';
import * as sameOrigin from 'same-origin';

import { Category } from 'sonarwhal/dist/src/lib/enums/category';
import { cutString, isRegularProtocol } from 'sonarwhal/dist/src/lib/utils/misc';
import { cutString, isRegularProtocol, sameOrigin } from 'sonarwhal/dist/src/lib/utils/misc';
import { debug as d } from 'sonarwhal/dist/src/lib/utils/debug';
import { IAsyncHTMLElement, ElementFound, IRule, RuleMetadata } from 'sonarwhal/dist/src/lib/types';
import { normalizeString } from 'sonarwhal/dist/src/lib/utils/misc';
Expand Down
5 changes: 5 additions & 0 deletions packages/sonarwhal/src/lib/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ const getSonarwhalPackage = () => {
return require(path.join(__dirname, '../../../../package.json'));
};

const sameOrigin = (url1: string, url2: string): boolean => {
return new URL(url1).origin === new URL(url2).origin;
};

export {
cutString,
delay,
Expand Down Expand Up @@ -375,6 +379,7 @@ export {
readFileAsync,
requestJSONAsync,
requestAsync,
sameOrigin,
toCamelCase,
writeFileAsync
};

0 comments on commit 27f8453

Please sign in to comment.