文件操作 - attempt.js
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/nodejs/lodash-es/attempt.js
编辑文件内容
import apply from './_apply.js'; import baseRest from './_baseRest.js'; import isError from './isError.js'; /** Detect free variable `globalThis` */ const freeGlobalThis = typeof globalThis == 'object' && globalThis !== null && globalThis.Object == Object && globalThis; /** * Attempts to invoke `func`, returning either the result or the caught error * object. Any additional arguments are provided to `func` when it's invoked. * * @static * @memberOf _ * @since 3.0.0 * @category Util * @param {Function} func The function to attempt. * @param {...*} [args] The arguments to invoke `func` with. * @returns {*} Returns the `func` result or error object. * @example * * // Avoid throwing errors for invalid selectors. * var elements = _.attempt(function(selector) { * return document.querySelectorAll(selector); * }, '>_>'); * * if (_.isError(elements)) { * elements = []; * } */ var attempt = baseRest(function(func, args) { try { return apply(func, undefined, args); } catch (e) { return isError(e) ? e : new Error(e); } }); export default attempt;
修改文件时间
将文件时间修改为当前时间的前一年
删除文件