deno.land / x / jose@v5.2.4 / lib / is_object.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function isObjectLike(value: unknown) { return typeof value === 'object' && value !== null}
export default function isObject<T = object>(input: unknown): input is T { if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') { return false } if (Object.getPrototypeOf(input) === null) { return true } let proto = input while (Object.getPrototypeOf(proto) !== null) { proto = Object.getPrototypeOf(proto) } return Object.getPrototypeOf(input) === proto}
jose

Version Info

Tagged at
a month ago