@expo/account-names
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -8,2 +8,4 @@ export declare enum NameValidationErrorCode { | ||
} | ||
export declare const minimumAccountNameLength = 3; | ||
export declare const maximumAccountNameLength = 128; | ||
/** | ||
@@ -10,0 +12,0 @@ * Asserts that the given account name or username is valid and throws an error with a descriptive |
"use strict"; | ||
exports.__esModule = true; | ||
exports.validateAccountName = exports.enforceValidAccountName = exports.NameValidationErrorCode = void 0; | ||
exports.validateAccountName = exports.enforceValidAccountName = exports.maximumAccountNameLength = exports.minimumAccountNameLength = exports.NameValidationErrorCode = void 0; | ||
var NameValidationErrorCode; | ||
@@ -12,4 +12,4 @@ (function (NameValidationErrorCode) { | ||
})(NameValidationErrorCode = exports.NameValidationErrorCode || (exports.NameValidationErrorCode = {})); | ||
var minLength = 3; | ||
var maxLength = 128; | ||
exports.minimumAccountNameLength = 3; | ||
exports.maximumAccountNameLength = 128; | ||
var regex = /^[a-z0-9]([._-]?[a-z0-9])*(?![._-]$)$/i; | ||
@@ -41,6 +41,6 @@ /** | ||
case NameValidationErrorCode.TOO_SHORT: | ||
error = new Error("Account names must be at least " + minLength + " characters"); | ||
error = new Error("Account names must be at least " + exports.minimumAccountNameLength + " characters"); | ||
break; | ||
case NameValidationErrorCode.TOO_LONG: | ||
error = new Error("Account names must be under " + maxLength + " characters"); | ||
error = new Error("Account names must be under " + exports.maximumAccountNameLength + " characters"); | ||
break; | ||
@@ -65,6 +65,6 @@ default: | ||
} | ||
if (name.length < minLength) { | ||
if (name.length < exports.minimumAccountNameLength) { | ||
return NameValidationErrorCode.TOO_SHORT; | ||
} | ||
if (name.length >= maxLength) { | ||
if (name.length >= exports.maximumAccountNameLength) { | ||
return NameValidationErrorCode.TOO_LONG; | ||
@@ -71,0 +71,0 @@ } |
{ | ||
"name": "@expo/account-names", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A validation library for Expo account names", | ||
@@ -5,0 +5,0 @@ "main": "build/names.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10030
100
1