@jamashita/anden-object
Advanced tools
Comparing version 2.23.0 to 2.24.0
@@ -1,5 +0,3 @@ | ||
import { Cloneable } from '@jamashita/anden-type'; | ||
import { Objet } from './Objet'; | ||
export declare abstract class Entity<I, T extends Entity<I, T>> extends Objet implements Cloneable<T> { | ||
abstract duplicate(): T; | ||
export declare abstract class Entity<I> extends Objet { | ||
abstract getIdentifier(): I; | ||
@@ -6,0 +4,0 @@ abstract serialize(): string; |
import { ObjectLiteral } from '@jamashita/anden-type'; | ||
import { Entity } from '../Entity'; | ||
export declare class MockEntity<V> extends Entity<V, MockEntity<V>> { | ||
export declare class MockEntity<V> extends Entity<V> { | ||
private readonly id; | ||
private other; | ||
constructor(id: V, other: ObjectLiteral); | ||
duplicate(): MockEntity<V>; | ||
getIdentifier(): V; | ||
@@ -9,0 +8,0 @@ serialize(): string; |
@@ -14,5 +14,2 @@ "use strict"; | ||
} | ||
duplicate() { | ||
return new MockEntity(this.id, this.other); | ||
} | ||
getIdentifier() { | ||
@@ -19,0 +16,0 @@ return this.id; |
@@ -23,3 +23,7 @@ "use strict"; | ||
hashCode() { | ||
return (0, object_hash_1.default)(this); | ||
const obj = {}; | ||
Object.entries(this).forEach(([k, v]) => { | ||
obj[k] = v; | ||
}); | ||
return (0, object_hash_1.default)(obj); | ||
} | ||
@@ -26,0 +30,0 @@ toString() { |
@@ -1,5 +0,3 @@ | ||
import { Cloneable } from '@jamashita/anden-type'; | ||
import { Objet } from './Objet'; | ||
export declare abstract class Entity<I, T extends Entity<I, T>> extends Objet implements Cloneable<T> { | ||
abstract duplicate(): T; | ||
export declare abstract class Entity<I> extends Objet { | ||
abstract getIdentifier(): I; | ||
@@ -6,0 +4,0 @@ abstract serialize(): string; |
import { ObjectLiteral } from '@jamashita/anden-type'; | ||
import { Entity } from '../Entity'; | ||
export declare class MockEntity<V> extends Entity<V, MockEntity<V>> { | ||
export declare class MockEntity<V> extends Entity<V> { | ||
private readonly id; | ||
private other; | ||
constructor(id: V, other: ObjectLiteral); | ||
duplicate(): MockEntity<V>; | ||
getIdentifier(): V; | ||
@@ -9,0 +8,0 @@ serialize(): string; |
@@ -11,5 +11,2 @@ import { Entity } from '../Entity'; | ||
} | ||
duplicate() { | ||
return new MockEntity(this.id, this.other); | ||
} | ||
getIdentifier() { | ||
@@ -16,0 +13,0 @@ return this.id; |
@@ -17,3 +17,7 @@ import { Kind } from '@jamashita/anden-type'; | ||
hashCode() { | ||
return hash(this); | ||
const obj = {}; | ||
Object.entries(this).forEach(([k, v]) => { | ||
obj[k] = v; | ||
}); | ||
return hash(obj); | ||
} | ||
@@ -20,0 +24,0 @@ toString() { |
{ | ||
"name": "@jamashita/anden-object", | ||
"version": "2.23.0", | ||
"version": "2.24.0", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -1,7 +0,5 @@ | ||
import { Cloneable, isEqualable } from '@jamashita/anden-type'; | ||
import { isEqualable } from '@jamashita/anden-type'; | ||
import { Objet } from './Objet'; | ||
export abstract class Entity<I, T extends Entity<I, T>> extends Objet implements Cloneable<T> { | ||
public abstract duplicate(): T; | ||
export abstract class Entity<I> extends Objet { | ||
public abstract getIdentifier(): I; | ||
@@ -8,0 +6,0 @@ |
@@ -5,3 +5,3 @@ import { ObjectLiteral } from '@jamashita/anden-type'; | ||
export class MockEntity<V> extends Entity<V, MockEntity<V>> { | ||
export class MockEntity<V> extends Entity<V> { | ||
private readonly id: V; | ||
@@ -16,6 +16,2 @@ private other: ObjectLiteral; | ||
public duplicate(): MockEntity<V> { | ||
return new MockEntity<V>(this.id, this.other); | ||
} | ||
public getIdentifier(): V { | ||
@@ -22,0 +18,0 @@ return this.id; |
@@ -26,3 +26,9 @@ import { Kind, Nominative } from '@jamashita/anden-type'; | ||
public hashCode(): string { | ||
return hash(this); | ||
const obj: Record<string, unknown> = {}; | ||
Object.entries(this).forEach(([k, v]: [string, unknown]) => { | ||
obj[k] = v; | ||
}); | ||
return hash(obj); | ||
} | ||
@@ -29,0 +35,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89871
582