Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

no-regex-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

no-regex-utils - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

4

dist/index.d.ts
import { onlyLetters, onlyNumbers } from "./manipulations";
import { isEmail, isIPv4, isUsername } from "./validations";
export { isEmail, isIPv4, isUsername, onlyNumbers, onlyLetters };
import { isEmail, isIPv4, isUrl, isUsername } from "./validations";
export { isEmail, isIPv4, isUsername, onlyNumbers, onlyLetters, isUrl };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onlyLetters = exports.onlyNumbers = exports.isUsername = exports.isIPv4 = exports.isEmail = void 0;
exports.isUrl = exports.onlyLetters = exports.onlyNumbers = exports.isUsername = exports.isIPv4 = exports.isEmail = void 0;
const manipulations_1 = require("./manipulations");

@@ -10,2 +10,3 @@ Object.defineProperty(exports, "onlyLetters", { enumerable: true, get: function () { return manipulations_1.onlyLetters; } });

Object.defineProperty(exports, "isIPv4", { enumerable: true, get: function () { return validations_1.isIPv4; } });
Object.defineProperty(exports, "isUrl", { enumerable: true, get: function () { return validations_1.isUrl; } });
Object.defineProperty(exports, "isUsername", { enumerable: true, get: function () { return validations_1.isUsername; } });
export declare const isEmail: (value: string) => boolean;
export declare const isIPv4: (value: string) => boolean;
export declare const isUrl: (value: string) => boolean;
export interface IIsUsernameOptions {

@@ -4,0 +5,0 @@ minLength?: number;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isUsername = exports.isIPv4 = exports.isEmail = void 0;
exports.isUsername = exports.isUrl = exports.isIPv4 = exports.isEmail = void 0;
const testRegex = (regex, value) => {
return new RegExp(regex).test(value);
};
const isEmail = (value) => {
return new RegExp("^([a-z0-9_.+-]+)@([da-z.-]+).([a-z.]{2,6})$").test(value);
return testRegex(/^([a-z0-9_.+-]+)@([da-z.-]+).([a-z.]{2,6})$/, value);
};
exports.isEmail = isEmail;
const isIPv4 = (value) => {
return new RegExp("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$").test(value);
return testRegex(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/, value);
};
exports.isIPv4 = isIPv4;
const isUrl = (value) => {
return testRegex(/^(?:http|https|ftp|mailto|file|data|irc|ws|wss):\/\/[A-Za-z0-9\-]{0,63}(\.[A-Za-z0-9\-]{0,63})+(:\d{1,4})?\/*(\/*[A-Za-z0-9\-._]+\/*)*(\?.*)?(#.*)?/, value);
};
exports.isUrl = isUrl;
const isUsername = (value, { minLength = 3, maxLength = 16, underline = true, dash = true, }) => {
let regex = `^[a-z0-9${underline ? "_" : ""}${dash ? "-" : ""}]{${minLength},${maxLength}}$`;
return new RegExp(regex).test(value);
return testRegex(new RegExp(regex), value);
};
exports.isUsername = isUsername;
{
"name": "no-regex-utils",
"version": "0.5.0",
"version": "0.6.0",
"description": "No Regex Utils - Common regex functions",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -44,2 +44,8 @@ # NO Regex Utils

> isUrl
```javascript
NoRegex.isUrl("https://google.com"); // true
```
### Manipulations

@@ -46,0 +52,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc