mirror of
https://github.com/bitwarden/browser
synced 2026-02-07 12:13:45 +00:00
20 lines
537 B
TypeScript
20 lines
537 B
TypeScript
import { map } from "rxjs";
|
|
|
|
import { CommandDefinition, EXTERNAL_SOURCE_TAG } from "@bitwarden/messaging";
|
|
|
|
export const getCommand = (
|
|
commandDefinition: CommandDefinition<Record<string, unknown>> | string,
|
|
) => {
|
|
if (typeof commandDefinition === "string") {
|
|
return commandDefinition;
|
|
} else {
|
|
return commandDefinition.command;
|
|
}
|
|
};
|
|
|
|
export const tagAsExternal = <T extends Record<PropertyKey, unknown>>() => {
|
|
return map((message: T) => {
|
|
return Object.assign(message, { [EXTERNAL_SOURCE_TAG]: true });
|
|
});
|
|
};
|