"space-before-blocks": ["error", "always"],
"curly": ["error", "all"],
"brace-style": "error",
- "eqeqeq": ["error", "always"],
"no-else-return": "error",
- "no-eq-null": "error",
"no-extra-bind": "error",
"no-lone-blocks": "error",
"no-multi-spaces": "error",
}
],
"block-spacing": "error",
- // "capitalized-comments": [
- // "error",
- // "always",
- // {
- // "ignoreConsecutiveComments": true,
- // "ignorePattern": "pragma|ignored"
- // }
- // ],
"eol-last": ["error", "always"],
"consistent-this": ["error", "self"],
"func-call-spacing": ["error", "never"],
return false;
};
-export const convertToDate = (value: Date | string | number | undefined): Date | undefined => {
+export const convertToDate = (
+ value: Date | string | number | null | undefined,
+): Date | null | undefined => {
if (isNullOrUndefined(value)) {
return value as undefined;
}
export const convertToBoolean = (value: unknown): boolean => {
let result = false;
- if (value) {
+ if (value != null) {
// Check the type
if (typeof value === 'boolean') {
return value;
};
export const isNullOrUndefined = (value: unknown): boolean => {
- // eslint-disable-next-line eqeqeq, no-eq-null
return value == null;
};
* @param workerOptions -
*/
constructor(workerScript: string, workerOptions: WorkerOptions) {
- if (workerScript === null || workerScript === undefined) {
+ if (workerScript == null) {
throw new Error('Worker script is not defined');
}
if (typeof workerScript === 'string' && workerScript.trim().length === 0) {
if (!this.started) {
throw new Error('Cannot add a WorkerSet element: not started');
}
- if (!this.workerSet) {
+ if (this.workerSet == null) {
throw new Error("Cannot add a WorkerSet element: 'workerSet' property does not exist");
}
const workerSetElement = await this.getWorkerSetElement();
await it('Verify convertToDate()', () => {
expect(convertToDate(undefined)).toBe(undefined);
+ expect(convertToDate(null)).toBe(null);
expect(() => convertToDate('')).toThrow(new Error("Cannot convert to date: ''"));
expect(() => convertToDate('00:70:61')).toThrow(
new Error("Cannot convert to date: '00:70:61'"),