Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1function isErrorInstance(obj) {2 return obj instanceof Error || Object.prototype.toString.call(obj) === '[object Error]';3}4 5function isRegExp(obj) {6 return Object.prototype.toString.call(obj) === '[object RegExp]';7}8 9/**10 * ### .compatibleInstance(thrown, errorLike)11 *12 * Checks if two instances are compatible (strict equal).13 * Returns false if errorLike is not an instance of Error, because instances14 * can only be compatible if they're both error instances.15 *16 * @name compatibleInstance17 * @param {Error} thrown error18 * @param {Error|ErrorConstructor} errorLike object to compare against19 * @namespace Utils20 * @api public21 */22 23function compatibleInstance(thrown, errorLike) {24 return isErrorInstance(errorLike) && thrown === errorLike;25}26 27/**28 * ### .compatibleConstructor(thrown, errorLike)29 *30 * Checks if two constructors are compatible.31 * This function can receive either an error constructor or32 * an error instance as the `errorLike` argument.33 * Constructors are compatible if they're the same or if one is34 * an instance of another.35 *36 * @name compatibleConstructor37 * @param {Error} thrown error38 * @param {Error|ErrorConstructor} errorLike object to compare against39 * @namespace Utils40 * @api public41 */42 43function compatibleConstructor(thrown, errorLike) {44 if (isErrorInstance(errorLike)) {45 // If `errorLike` is an instance of any error we compare their constructors46 return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;47 } else if ((typeof errorLike === 'object' || typeof errorLike === 'function') && errorLike.prototype) {48 // If `errorLike` is a constructor that inherits from Error, we compare `thrown` to `errorLike` directly49 return thrown.constructor === errorLike || thrown instanceof errorLike;50 }51 52 return false;53}54 55/**56 * ### .compatibleMessage(thrown, errMatcher)57 *58 * Checks if an error's message is compatible with a matcher (String or RegExp).59 * If the message contains the String or passes the RegExp test,60 * it is considered compatible.61 *62 * @name compatibleMessage63 * @param {Error} thrown error64 * @param {String|RegExp} errMatcher to look for into the message65 * @namespace Utils66 * @api public67 */68 69function compatibleMessage(thrown, errMatcher) {70 const comparisonString = typeof thrown === 'string' ? thrown : thrown.message;71 if (comparisonString === undefined) {72 return false;73 }74 if (isRegExp(errMatcher)) {75 return errMatcher.test(comparisonString);76 } else if (typeof errMatcher === 'string') {77 return comparisonString.indexOf(errMatcher) !== -1;78 }79 80 return false;81}82 83/**84 * ### .getConstructorName(errorLike)85 *86 * Gets the constructor name for an Error instance or constructor itself.87 *88 * @name getConstructorName89 * @param {Error|ErrorConstructor} errorLike90 * @namespace Utils91 * @api public92 */93 94function getConstructorName(errorLike) {95 let constructorName = errorLike;96 if (isErrorInstance(errorLike)) {97 constructorName = errorLike.constructor.name;98 } else if (typeof errorLike === 'function') {99 // If `err` is not an instance of Error it is an error constructor itself or another function.100 // If we've got a common function we get its name, otherwise we may need to create a new instance101 // of the error just in case it's a poorly-constructed error. Please see chaijs/chai/issues/45 to know more.102 constructorName = errorLike.name;103 if (constructorName === '') {104 const newConstructorName = (new errorLike().name);105 constructorName = newConstructorName || constructorName;106 }107 }108 109 return constructorName;110}111 112/**113 * ### .getMessage(errorLike)114 *115 * Gets the error message from an error.116 * If `err` is a String itself, we return it.117 * If the error has no message, we return an empty string.118 *119 * @name getMessage120 * @param {Error|String} errorLike121 * @namespace Utils122 * @api public123 */124 125function getMessage(errorLike) {126 let msg = '';127 if (errorLike && errorLike.message) {128 msg = errorLike.message;129 } else if (typeof errorLike === 'string') {130 msg = errorLike;131 }132 133 return msg;134}135 136export { compatibleInstance, compatibleConstructor, compatibleMessage, getMessage, getConstructorName };137 