UNPKG

is-quick-hash

Version:

Checks if a string looks like a hash generated by quick-hash

13 lines (11 loc) 428 B
'use strict' var isHash = /^[a-z\d]{5,7}$/ var isNumber = require('lodash.isfinite') /** * @id isQuickHash * @function isQuickHash * Checks if a string looks like a hash generated by quick-hash * @param {string} val - the string to check * @returns {boolean} looksLikeQuickHash - `true` if `val` looks like a hash generated by quick-hash, `false` otherwise */ module.exports = (val) => !isNumber(val) && isHash.test(val)