c74f9187d7c3c8f2eb9b586f0ac39ebafce0e110 1.0 KB

12345
  1. {
  2. "code": "export default class Dictionary {\r\n constructor() {\r\n this._container = {};\r\n this._length = 0;\r\n }\r\n get container() {\r\n return this._container;\r\n }\r\n get size() {\r\n return this._length;\r\n }\r\n set(key, value) {\r\n if (!this._container.hasOwnProperty(key)) {\r\n this._length++;\r\n }\r\n this._container[key] = value;\r\n }\r\n delete(key) {\r\n if (this._container.hasOwnProperty(key)) {\r\n delete this._container[key];\r\n this._length--;\r\n }\r\n }\r\n has(key) {\r\n return this._container.hasOwnProperty(key) ? true : false;\r\n }\r\n get(key) {\r\n if (this._container.hasOwnProperty(key)) {\r\n return this._container[key];\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n clear() {\r\n this._container = {};\r\n this._length = 0;\r\n }\r\n}\r\n",
  3. "references": []
  4. }