UNPKG

@sudoo/marked

Version:

JavaScript & TypeScript code runner in JavaScript, safe with marked territory, asynchronous

23 lines (22 loc) 908 B
"use strict"; /** * @author WMXPY * @namespace Operation_MemberExpression * @description Class Instance */ Object.defineProperty(exports, "__esModule", { value: true }); exports.memberExpressionClassInstance = void 0; const error_code_1 = require("../../declare/error-code"); const error_1 = require("../../util/error/error"); const sand_function_1 = require("../../variable/sand-function/sand-function"); const memberExpressionClassInstance = (sandbox, sandClassInstance, key) => { if (typeof key === "string") { const target = sandClassInstance.lookFor(key); if (target instanceof sand_function_1.SandFunction) { return target.bindThisValue(sandClassInstance); } return target; } throw (0, error_1.error)(error_code_1.ERROR_CODE.ONLY_STRING_AVAILABLE_FOR_CLASS_INSTANCE); }; exports.memberExpressionClassInstance = memberExpressionClassInstance;