Skip to content

Commit

Permalink
Merge pull request #2828 from balena-io/remove-package-resin-valid-email
Browse files Browse the repository at this point in the history
Remove package `@resin.io/valid-email`
  • Loading branch information
flowzone-app[bot] authored Sep 12, 2024
2 parents 6a1239b + a2b4f76 commit c25591c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 31 deletions.
9 changes: 0 additions & 9 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@
"@balena/env-parsing": "^1.1.8",
"@balena/es-version": "^1.0.1",
"@oclif/core": "^4.0.8",
"@resin.io/valid-email": "^0.1.0",
"@sentry/node": "^6.16.1",
"balena-config-json": "^4.2.0",
"balena-device-init": "^7.0.1",
Expand Down
9 changes: 6 additions & 3 deletions src/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import validEmail = require('@resin.io/valid-email');
import { ExpectedError } from '../errors';

// Sufficiently good email regex in order not to bring in another dependency.
const isValidEmail = (email: string): boolean => {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
};

const APPNAME_REGEX = new RegExp(/^[a-zA-Z0-9_-]+$/);
// An regex to detect an IP address, from https://www.regular-expressions.info/ip.html
const IP_REGEX = new RegExp(
Expand All @@ -26,7 +29,7 @@ const DOTLOCAL_REGEX = new RegExp(/^([a-zA-Z0-9-]+\.)+local$/);
const UUID_REGEX = new RegExp(/^[0-9a-f]+$/);

export function validateEmail(input: string) {
if (!validEmail(input)) {
if (!isValidEmail(input)) {
return 'Email is not valid';
}

Expand Down
18 changes: 0 additions & 18 deletions typings/resin.io/index.d.ts

This file was deleted.

0 comments on commit c25591c

Please sign in to comment.