cloudfunctions/SegmentPortraitPic/node_modules/bson/src/timestamp.ts
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
import { Long } from './long';
import { isObjectLike } from './parser/utils';
/** @public */
export type TimestampOverrides = '_bsontype' | 'toExtendedJSON' | 'fromExtendedJSON' | 'inspect';
/** @public */
export type LongWithoutOverrides = new (low: unknown, high?: number, unsigned?: boolean) => {
[P in Exclude<keyof Long, TimestampOverrides>]: Long[P];
};
/** @public */
export const LongWithoutOverridesClass: LongWithoutOverrides =
Long as unknown as LongWithoutOverrides;
/** @public */
export interface TimestampExtended {
$timestamp: {
t: number;
i: number;
};
}
/** @public */
export class Timestamp extends LongWithoutOverridesClass {
_bsontype!: 'Timestamp';
static readonly MAX_VALUE = Long.MAX_UNSIGNED_VALUE;
/**
* @param low - A 64-bit Long representing the Timestamp.
*/
constructor(long: Long);
/**
* @param value - A pair of two values indicating timestamp and increment.
*/
constructor(value: { t: number; i: number });
/**
* @param low - the low (signed) 32 bits of the Timestamp.
* @param high - the high (signed) 32 bits of the Timestamp.
* @deprecated Please use `Timestamp({ t: high, i: low })` or `Timestamp(Long(low, high))` instead.
*/
constructor(low: number, high: number);
constructor(low: number | Long | { t: number; i: number }, high?: number) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
///@ts-expect-error
if (!(this instanceof Timestamp)) return new Timestamp(low, high);
if (Long.isLong(low)) {
super(low.low, low.high, true);
} else if (isObjectLike(low) && typeof low.t !== 'undefined' && typeof low.i !== 'undefined') {
super(low.i, low.t, true);
} else {
super(low, high, true);
}
Object.defineProperty(this, '_bsontype', {
value: 'Timestamp',
writable: false,
configurable: false,
enumerable: false
});
}
后面还有 56 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
