Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const isDOMNode = (domNode: unknown): domNode is Node =>
isObject(Node)
? domNode instanceof Node
: isObject(domNode) && isNumber(Cast(domNode).nodeType) && isString(Cast(domNode).nodeName);
export const isNode = (domNode: unknown): domNode is Node =>
isObject(Node)
? domNode instanceof Node
: isObject(domNode) && isNumber((domNode as any).nodeType) && isString((domNode as any).nodeName);
public alpha(alpha?: number | string): HSL {
return this.clone({ ...this.hsla, a: createValidAlpha(isNumber(alpha) ? `${alpha}%` : alpha) });
}
const isValidHue = (hue: unknown): hue is Hue => isNumber(hue) && hue <= 360 && hue >= 0;
const createValidHue = (value: number | string) => {
}: RemoveMarkParams): CommandFunction => (state, dispatch) => {
const { selection } = state;
const tr = callMethod({ fn: startTransaction, defaultReturn: state.tr }, [state.tr, state]);
let { from, to } = range ?? selection;
if (expand) {
({ from, to } = range
? getMarkRange(state.doc.resolve(range.from), type) ||
(isNumber(range.to) && getMarkRange(state.doc.resolve(range.to), type)) || { from, to }
: selectionEmpty(state)
? getMarkRange(state.selection.$anchor, type) || { from, to }
: { from, to });
}
tr.removeMark(from, isNumber(to) ? to : from, type);
if (dispatch) {
dispatch(callMethod({ fn: endTransaction, defaultReturn: tr }, [tr, state]));
}
return true;
};
const isValidPercent = (percent: unknown): percent is Percent =>
isNumber(percent) && percent <= 100 && percent >= 0;
export const isValidIndex = (index: number | undefined | null): index is number =>
isNumber(index) && index > -1;
}: RemoveMarkParams): CommandFunction => (state, dispatch) => {
const { selection } = state;
const tr = callMethod({ fn: startTransaction, defaultReturn: state.tr }, [state.tr, state]);
let { from, to } = range ?? selection;
if (expand) {
({ from, to } = range
? getMarkRange(state.doc.resolve(range.from), type) ||
(isNumber(range.to) && getMarkRange(state.doc.resolve(range.to), type)) || { from, to }
: selectionEmpty(state)
? getMarkRange(state.selection.$anchor, type) || { from, to }
: { from, to });
}
tr.removeMark(from, isNumber(to) ? to : from, type);
if (dispatch) {
dispatch(callMethod({ fn: endTransaction, defaultReturn: tr }, [tr, state]));
}
return true;
};