Greasy Fork

Greasy Fork is available in English.

Monkey Utils

Useful library with JavaScript utilities.

当前为 2020-06-21 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/405813/818827/Monkey%20Utils.js

// ==UserScript==
// @name Monkey Utils
// @namespace https://rafaelgssa.gitlab.io/monkey-scripts
// @author rafaelgssa
// @version 1.0.0
// @description Useful library with JavaScript utilities.
// ==/UserScript==

// eslint-disable-next-line
const MonkeyUtils = (() => {
	/**
	 * Checks if a value is set.
	 * @template T
	 * @param {T} value The value to check.
	 * @returns {value is NonNullable<T>}
	 */
	const isSet = (value) => {
		return typeof value !== 'undefined' && value !== null;
	};

	return {
		isSet,
	};
})();