Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f90360
commit 0aa585a
Showing
4 changed files
with
93 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright IBM Corp. 2017,2019. All Rights Reserved. | ||
// Node module: @loopback/repository | ||
// This file is licensed under the MIT License. | ||
// License text available at https://opensource.org/licenses/MIT | ||
|
||
import {Type} from './type'; | ||
|
||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
/** | ||
* Null type | ||
*/ | ||
export class NullType implements Type<null> { | ||
readonly name = 'boolean'; | ||
|
||
isInstance(value: any) { | ||
return value === null; | ||
} | ||
|
||
defaultValue() { | ||
return null; | ||
} | ||
|
||
isCoercible(value: any): boolean { | ||
return value == null; | ||
} | ||
|
||
coerce(value: any) { | ||
return null; | ||
} | ||
|
||
serialize(value: boolean | null | undefined) { | ||
return null; | ||
} | ||
} |