MCPcopy Create free account
hub / github.com/melonjs/melonJS / prefixed

Function prefixed

packages/melonjs/src/utils/agent.ts:14–28  ·  view source on GitHub ↗
(name: string, obj?: Record<string, unknown>)

Source from the content-addressed store, hash-verified

12 * @returns Value of property
13 */
14export function prefixed(name: string, obj?: Record<string, unknown>) {
15 obj = obj || globalThis;
16 if (name in obj) {
17 return obj[name];
18 }
19
20 const uc_name = capitalize(name);
21
22 let result;
23 vendors.some((vendor) => {
24 const name = vendor + uc_name;
25 return (result = name in obj ? obj[name] : undefined);
26 });
27 return result;
28}
29
30/**
31 * Set a vendor-prefixed property

Callers 3

getScreenOrientationFunction · 0.90
lockOrientationFunction · 0.90
unlockOrientationFunction · 0.90

Calls 1

capitalizeFunction · 0.90

Tested by

no test coverage detected