PageSourceSearch

https://app.flyfishermanschannel.com/vendor/radiantmediaplayer/rmp…/Source/service-method-utils.js

js flyfishermanschannel.com collected 2026-09-26 09:49:30 UTC 3,067 bytes, 111 lines download raw bytes

1goog.module('omid.common.serviceMethodUtils');
2
3/**
4 * Prefix for a method identifying which service it is intended for.
5 * @enum {string}
6 */
7const ServiceMethodPrefix = {
8  SESSION_SERVICE: 'SessionService.',
9  VERIFICATION_SERVICE: 'VerificationService.',
10};
11
12/**
13 * Creates a prefixed session service method from an unprefixed method.
14 * @param {string} unprefixedMethod
15 * @return {string}
16 */
17function getPrefixedSessionServiceMethod(unprefixedMethod) {
18  return getPrefixedMethod(
19    unprefixedMethod,
20    ServiceMethodPrefix.SESSION_SERVICE,
21  );
22}
23
24/**
25 * Extracts the unprefixed session service method from a prefixed method.
26 * Returns `null` if the method is not intended for the session service.
27 * @param {string} prefixedMethod
28 * @return {?string}
29 */
30function getUnprefixedSessionServiceMethod(prefixedMethod) {
31  return getUnprefixedMethod(
32    prefixedMethod,
33    ServiceMethodPrefix.SESSION_SERVICE,
34  );
35}
36
37/**
38 * Checks whether a prefixed method is intended for the session service.
39 * @param {string} prefixedMethod
40 * @return {boolean}
41 */
42function isPrefixedSessionServiceMethod(prefixedMethod) {
43  return getUnprefixedSessionServiceMethod(prefixedMethod) != null;
44}
45
46/**
47 * Creates a prefixed verification service method from an unprefixed method.
48 * @param {string} unprefixedMethod
49 * @return {string}
50 */
51function getPrefixedVerificationServiceMethod(unprefixedMethod) {
52  return getPrefixedMethod(
53    unprefixedMethod,
54    ServiceMethodPrefix.VERIFICATION_SERVICE,
55  );
56}
57
58/**
59 * Extracts the unprefixed verification service method from a prefixed method.
60 * Returns `null` if the method is not intended for the verification service.
61 * @param {string} prefixedMethod
62 * @return {?string}
63 */
64function getUnprefixedVerificationServiceMethod(prefixedMethod) {
65  return getUnprefixedMethod(
66    prefixedMethod,
67    ServiceMethodPrefix.VERIFICATION_SERVICE,
68  );
69}
70
71/**
72 * Checks whether a prefixed method is intended for the verification service.
73 * @param {string} prefixedMethod
74 * @return {boolean}
75 */
76function isPrefixedVerificationServiceMethod(prefixedMethod) {
77  return getUnprefixedVerificationServiceMethod(prefixedMethod) != null;
78}
79
80/**
81 * Creates a prefixed method from an unprefixed method given the prefix.
82 * @param {string} unprefixedMethod
83 * @param {string} prefix
84 * @return {string}
85 * @private
86 */
87function getPrefixedMethod(unprefixedMethod, prefix) {
88  return prefix + unprefixedMethod;
89}
90
91/**
92 * Extracts the unprefixed method from a prefixed method given the prefix.
93 * Returns `null` if the given prefix is not used.
94 * @param {string} prefixedMethod
95 * @param {string} prefix
96 * @return {?string}
97 * @private
98 */
99function getUnprefixedMethod(prefixedMethod, prefix) {
100  const match = prefixedMethod.match(new RegExp(`^${prefix}(.*)`));
101  return match && match[1];
102}
103
104exports = {
105  getPrefixedSessionServiceMethod,
106  getPrefixedVerificationServiceMethod,
107  getUnprefixedSessionServiceMethod,
108  getUnprefixedVerificationServiceMethod,
109  isPrefixedSessionServiceMethod,
110  isPrefixedVerificationServiceMethod,
111};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.