first commit
This commit is contained in:
12
src/boot/helpers.ts
Normal file
12
src/boot/helpers.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export function isObjEqual<Type>(obj1: Type, obj2: Type): boolean {
|
||||
return obj1 && obj2 && Object.keys(obj1).length === Object.keys(obj2).length &&
|
||||
(Object.keys(obj1) as (keyof typeof obj1)[]).every(key => {
|
||||
return Object.prototype.hasOwnProperty.call(obj2, key) && obj1[key] === obj2[key]
|
||||
})
|
||||
}
|
||||
|
||||
export function parseIntString (s: string | string[] | undefined) :number | null {
|
||||
if (typeof s !== 'string') return null
|
||||
const regex = /^[+-]?\d+$/
|
||||
return regex.test(s) ? Number(s) : null
|
||||
}
|
||||
Reference in New Issue
Block a user