This file contains hidden or 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
| sonar.projectKey = company:mycompay | |
| sonar.projectName = My Project | |
| sonar.projectVersion = 0.0.1 | |
| sonar.sourceEncoding = UTF-8 | |
| sonar.sources = src/app | |
| sonar.exclusions = **/node_modules/**,**/*.spec.ts | |
| sonar.tests = src/app | |
| sonar.test.inclusions = **/*.spec.ts | |
| sonar.ts.tslint.configPath = tslint.json |
This file contains hidden or 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
| /** | |
| * @description Method to check if an item is an object. Date and Function are considered | |
| * an object, so if you need to exclude those, please update the method accordingly. | |
| * @param item - The item that needs to be checked | |
| * @return {Boolean} Whether or not @item is an object | |
| */ | |
| function isObject(item) { | |
| return (item === Object(item) && !Array.isArray(item)); | |
| } |
This file contains hidden or 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
| interface IIsObject { | |
| (item: any): boolean; | |
| } | |
| interface IObject { | |
| [key: string]: any; | |
| } | |
| interface IDeepMerge { | |
| (target: IObject, ...sources: Array<IObject>): IObject; |
This file contains hidden or 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
| interface IAsyncAwait<T, R> { | |
| error: R|Error|null; | |
| response: T|null; | |
| } | |
| // async/await utility function for more elegant handling of failures | |
| const asyncAwaitHandler: <A, B>(promise: Promise<A>) => Promise<IAsyncAwait<A|null, B|null>> = <A, B>(promise: Promise<A>): Promise<IAsyncAwait<A|null, B|null>> => { | |
| return promise | |
| .then((response: A): IAsyncAwait<A, null> => ({ error: null, response })) | |
| .catch((error: B): Promise<IAsyncAwait<null, B>> => Promise.resolve({ error, response: null })); |
This file contains hidden or 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
| // async/await utility function for more elegant handling of failures | |
| const asyncAwaitHandler = promise => { | |
| return promise | |
| .then(response => ({ error: null, response })) | |
| .catch(error => Promise.resolve({ error, response: null })); | |
| }; | |
| // example promise | |
| const myPromise = (errorMe) => { | |
| if (errorMe) { |
OlderNewer