fix(platform-browser): support 0/false/null values in transfer_state (#22179)

Issue #22178

PR Close #22179
This commit is contained in:
adasilva
2018-02-12 16:03:53 -05:00
committed by Miško Hevery
parent 16d1700a8e
commit 6435ecd3c6
2 changed files with 24 additions and 1 deletions

View File

@ -93,7 +93,9 @@ export class TransferState {
/**
* Get the value corresponding to a key. Return `defaultValue` if key is not found.
*/
get<T>(key: StateKey<T>, defaultValue: T): T { return this.store[key] as T || defaultValue; }
get<T>(key: StateKey<T>, defaultValue: T): T {
return this.store[key] !== undefined ? this.store[key] as T : defaultValue;
}
/**
* Set the value corresponding to a key.