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 23, 2018
1 parent 59ea34c commit 15c1052
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/rule-disown-opener/src/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { isSupported } from 'caniuse-api';
import * as pluralize from 'pluralize';

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 15c1052

Please sign in to comment.