[
  {
    "tags": [],
    "description": {
      "full": "",
      "summary": "",
      "body": ""
    },
    "isPrivate": false,
    "isConstructor": false,
    "line": 1,
    "codeStart": null,
    "code": "export function makePropertyMapper<T>(prototype: any, key: string, mapper: (value: any) => T) {\n  const values = new Map<any, T>();\n  Object.defineProperty(prototype, key, {\n    get() {\n      let v = values.get(this);\n      if(!v) {\n        values.set(this, mapper(null));\n      }\n      return values.get(this);\n\n    },\n    set(firstValue: any) {\n      Object.defineProperty(this, key, {\n        get() {\n          return values.get(this);\n        },\n        set(value: any) {\n          values.set(this, mapper(value));\n        },\n        enumerable: true,\n      });\n      this[key] = firstValue;\n    },\n    enumerable: true,\n    configurable: true,\n  });\n}",
    "ctx": false
  }
]