UNPKG

typescript-util

Version:

JS/TS 的简单工具

40 lines 899 B
import { BaseObject } from './BaseObject'; /** * KeyValue * @author LL * @date 2022-01-23 上午 1:52 **/ export class KeyValue extends BaseObject { key; value; constructor(key, value) { super(); this.key = key; this.value = value; } equals(o) { if (super.equals(o)) { return true; } if (!(o instanceof KeyValue)) { return false; } return o.key === this.key && o.value === this.value; } hashCode() { return super.hashCode(); } toString() { return `${this.key}=${this.value}`; } /** * toString 的 "重载" * 可以自定义分隔符 connect 默认 = * @param {string} connect * @return {string} */ toStr(connect = '=') { return `${this.key}${connect}${this.value}`; } } //# sourceMappingURL=KeyValue.js.map