Skip to content

Commit 9a16a0b

Browse files
unified is
1 parent c834989 commit 9a16a0b

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

packages/sources/walkerjs/src/lib/handle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import {
44
Const,
55
assign,
66
isArray,
7+
isElementOrDocument,
78
isObject,
89
isSameType,
910
on,
1011
pushToDestinations,
1112
setConsent,
1213
tryCatchAsync,
1314
} from '@elbwalker/utils';
14-
import { isElementOrDocument } from './helper';
1515
import { initScopeTrigger, ready } from './trigger';
1616
import { getState } from './state';
1717
import { addDestination } from './destination';

packages/sources/walkerjs/src/lib/helper.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/sources/walkerjs/src/lib/push.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import type { WalkerOS } from '@elbwalker/types';
22
import type { Elb, SourceWalkerjs } from '../types';
3-
import { isCommand, isElementOrDocument } from './helper';
43
import { handleCommand, handleEvent } from './handle';
54
import {
65
Const,
76
assign,
87
isArguments,
98
isArray,
9+
isCommand,
10+
isElementOrDocument,
1011
isObject,
1112
isSameType,
1213
isString,

packages/utils/src/core/is.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { WalkerOS } from '@elbwalker/types';
2+
import { Const } from './constants';
23

34
export function isArguments(value: unknown): value is IArguments {
45
return Object.prototype.toString.call(value) === '[object Arguments]';
@@ -12,10 +13,18 @@ export function isBoolean(value: unknown): value is boolean {
1213
return typeof value === 'boolean';
1314
}
1415

16+
export function isCommand(entity: string) {
17+
return entity === Const.Commands.Walker;
18+
}
19+
1520
export function isDefined<T>(val: T | undefined): val is T {
1621
return typeof val !== 'undefined';
1722
}
1823

24+
export function isElementOrDocument(elem: unknown): elem is Element {
25+
return elem === document || elem instanceof Element;
26+
}
27+
1928
export function isNumber(value: unknown): value is number {
2029
return typeof value === 'number' && !Number.isNaN(value);
2130
}

0 commit comments

Comments
 (0)