Skip to content

Commit

Permalink
Updated Value handling
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-jonathan committed Mar 8, 2025
1 parent 84a3061 commit cc19d18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cosmicmind/domainjs",
"version": "0.0.1-rc-030725-4",
"version": "0.0.1-rc-030725-4.1",
"description": "A domain-driven design framework for scalable systems.",
"keywords": [
"typescript",
Expand Down
4 changes: 2 additions & 2 deletions src/Value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ export const defineValue = <V extends Value<ValueTypeFor<V>>>(_class: ValueConst
*/
function createValueHandler<V extends Value<ValueTypeFor<V>>, T extends ValueTypeFor<V> = ValueTypeFor<V>>(handler: ValueLifecycle<V>): ProxyHandler<V> {
return {
set(target: V, key: 'value', value: T): boolean | never {
if (false === handler.validator?.(value, target)) {
set(target: V, key: string | symbol, value: T): boolean | never {
if ('value' === key && false === handler.validator?.(value, target)) {
throw new ValueError(`${String(key)} is invalid`)
}
return Reflect.set(target, key, value)
Expand Down

0 comments on commit cc19d18

Please sign in to comment.