-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate manager-api to strict ts
Co-authored-by: LuisChiej <[email protected]>
- Loading branch information
Showing
20 changed files
with
423 additions
and
269 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
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 |
---|---|---|
@@ -1,14 +1,21 @@ | ||
/* eslint-disable no-underscore-dangle */ | ||
/* eslint-disable func-names */ | ||
import type { DeveloperTools } from 'store2'; | ||
import { parse, stringify } from 'telejson'; | ||
|
||
// setting up the store, overriding set and get to use telejson | ||
export default (_: any) => { | ||
_.fn('set', function (key: string, data: object) { | ||
return _.set(this._area, this._in(key), stringify(data, { maxDepth: 50 })); | ||
}); | ||
_.fn('get', function (key: string, alt: string) { | ||
const value = _.get(this._area, this._in(key)); | ||
return value !== null ? parse(value) : alt || value; | ||
}); | ||
export default (_: DeveloperTools) => { | ||
_.fn( | ||
'set', | ||
function (this: { _area: Storage; _in: (key: string) => string }, key: string, data: object) { | ||
return _.set(this._area, this._in(key), stringify(data, { maxDepth: 50 })); | ||
} | ||
); | ||
_.fn( | ||
'get', | ||
function (this: { _area: Storage; _in: (key: string) => string }, key: string, alt: string) { | ||
const value = _.get(this._area, this._in(key)); | ||
return value !== null ? parse(value) : alt || value; | ||
} | ||
); | ||
}; |
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
Oops, something went wrong.