How to use the typeable.isString function in typeable

To help you get started, we’ve selected a few typeable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xpepermint / validatablejs / src / validators / string-hex-color.ts View on Github external
export function stringHexColor (value: any): boolean {
  if (!isString(value)) return false;

  return /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i.test(value);
}
github xpepermint / validatablejs / src / validators / string-hexadecimal.ts View on Github external
export function stringHexadecimal (value: any): boolean {
  if (!isString(value)) return false;

  return /^[0-9A-F]+$/i.test(value);
}
github xpepermint / validatablejs / src / validators / string-match.ts View on Github external
export function stringMatch (value: any, recipe: StringMatchOptions = {}): boolean {
  if (!isString(value)) return false;

  let { regexp } = recipe;
  return regexp.test(value);
};
github xpepermint / validatablejs / dist / validators / string-length.js View on Github external
function stringLength(value, recipe) {
    if (recipe === void 0) { recipe = {}; }
    if (!typeable_1.isString(value))
        return false;
    var _a = recipe.bytes, bytes = _a === void 0 ? false : _a, min = recipe.min, minOrEqual = recipe.minOrEqual, max = recipe.max, maxOrEqual = recipe.maxOrEqual;
    var len = bytes
        ? encodeURI(value).split(/%..|./).length - 1
        : value.length;
    if (typeable_1.isNumber(min) && !(len > min))
        return false;
    if (typeable_1.isNumber(minOrEqual) && !(len >= minOrEqual))
        return false;
    if (typeable_1.isNumber(max) && !(len < max))
        return false;
    if (typeable_1.isNumber(maxOrEqual) && !(len <= maxOrEqual))
        return false;
    return true;
}
exports.stringLength = stringLength;
github xpepermint / validatablejs / dist / validators / string-hex-color.js View on Github external
function stringHexColor(value) {
    if (!typeable_1.isString(value))
        return false;
    return /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i.test(value);
}
exports.stringHexColor = stringHexColor;
github xpepermint / validatablejs / dist / validators / string-match.js View on Github external
function stringMatch(value, recipe) {
    if (recipe === void 0) { recipe = {}; }
    if (!typeable_1.isString(value))
        return false;
    var regexp = recipe.regexp;
    return regexp.test(value);
}
exports.stringMatch = stringMatch;
github xpepermint / validatablejs / dist / validators / string-hexadecimal.js View on Github external
function stringHexadecimal(value) {
    if (!typeable_1.isString(value))
        return false;
    return /^[0-9A-F]+$/i.test(value);
}
exports.stringHexadecimal = stringHexadecimal;
github xpepermint / validatablejs / dist / validators / string-base64.js View on Github external
function stringBase64(value) {
    if (!typeable_1.isString(value))
        return false;
    return BASE64_REGEX.test(value);
}
exports.stringBase64 = stringBase64;
github rawmodel / framework / dist / src / models.js View on Github external
.forEach(function (name) {
            var field = _this._fields[name];
            var value = field.cast(data[name]);
            if (typeable_1.isString(strategy)
                && typeable_1.isArray(field.populatable)
                && field.populatable.indexOf(strategy) !== -1
                || !typeable_1.isString(strategy)) {
                _this[name] = toValue(value);
            }
        });
        return this;
github rawmodel / framework / dist / src / models.js View on Github external
.forEach(function (name) {
            var field = _this._fields[name];
            var value = field.cast(data[name]);
            if (typeable_1.isString(strategy)
                && typeable_1.isArray(field.populatable)
                && field.populatable.indexOf(strategy) !== -1
                || !typeable_1.isString(strategy)) {
                _this[name] = toValue(value);
            }
        });
        return this;

typeable

A library for checking and casting types.

MIT
Latest version published 7 years ago

Package Health Score

42 / 100
Full package analysis

Popular typeable functions