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

amplify-prompts

Package Overview
Dependencies
Maintainers
1
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amplify-prompts - npm Package Compare versions

Comparing version 2.6.3-upgrade-graphql15-2.0 to 2.6.3-upgrade-graphql15-lazyload.0

3

API.md

@@ -66,2 +66,5 @@ ## API Report File for "amplify-prompts"

// @public (undocumented)
export const between: (min: number, max: number, message?: string | undefined) => Validator;
// Warning: (ae-forgotten-export) The symbol "EqualsFunction" needs to be exported by the entry point index.d.ts

@@ -68,0 +71,0 @@ // Warning: (ae-forgotten-export) The symbol "SingleFilterFunction" needs to be exported by the entry point index.d.ts

2

CHANGELOG.md

@@ -6,3 +6,3 @@ # Change Log

## [2.6.3-upgrade-graphql15-2.0](https://github.com/aws-amplify/amplify-cli/compare/amplify-prompts@2.6.2...amplify-prompts@2.6.3-upgrade-graphql15-2.0) (2023-01-18)
## [2.6.3-upgrade-graphql15-lazyload.0](https://github.com/aws-amplify/amplify-cli/compare/amplify-prompts@2.6.2...amplify-prompts@2.6.3-upgrade-graphql15-lazyload.0) (2023-01-25)

@@ -9,0 +9,0 @@

@@ -8,2 +8,3 @@ export declare type Validator = (value: string) => true | string | Promise<true | string>;

export declare const exact: (expected: string, message?: string | undefined) => Validator;
export declare const between: (min: number, max: number, message?: string | undefined) => Validator;
export declare const and: (validators: [Validator, Validator, ...Validator[]], message?: string | undefined) => Validator;

@@ -10,0 +11,0 @@ export declare const or: (validators: [Validator, Validator, ...Validator[]], message?: string | undefined) => Validator;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.not = exports.or = exports.and = exports.exact = exports.minLength = exports.maxLength = exports.integer = exports.matchRegex = exports.alphanumeric = void 0;
exports.not = exports.or = exports.and = exports.between = exports.exact = exports.minLength = exports.maxLength = exports.integer = exports.matchRegex = exports.alphanumeric = void 0;
const alphanumeric = (message = 'Input must be alphanumeric') => (input) => /^[a-zA-Z0-9]+$/.test(input) ? true : message;

@@ -8,3 +8,3 @@ exports.alphanumeric = alphanumeric;

exports.matchRegex = matchRegex;
const integer = (message = 'Input must be a number') => (input) => /^[0-9]+$/.test(input) ? true : message;
const integer = (message = 'Input must be a number') => (input) => (/^[0-9]+$/.test(input) ? true : message);
exports.integer = integer;

@@ -17,2 +17,4 @@ const maxLength = (maxLen, message) => (input) => input.length > maxLen ? message || `Input must be less than ${maxLen} characters long` : true;

exports.exact = exact;
const between = (min, max, message) => (input) => parseInt(input) >= min && parseInt(input) <= max ? true : message || `Input must be between ${min} and ${max}`;
exports.between = between;
const and = (validators, message) => async (input) => {

@@ -19,0 +21,0 @@ for (const validator of validators) {

{
"name": "amplify-prompts",
"version": "2.6.3-upgrade-graphql15-2.0",
"version": "2.6.3-upgrade-graphql15-lazyload.0",
"description": "Utility functions for Amplify CLI terminal I/O",

@@ -53,3 +53,3 @@ "main": "lib/index.js",

},
"gitHead": "a9179c71eceb850a395f81e2d3b9623b3eb7663c"
"gitHead": "986d2f8aa618af1af56931399f3e809715bb18ef"
}

@@ -15,32 +15,22 @@ export type Validator = (value: string) => true | string | Promise<true | string>;

export const alphanumeric =
(message = 'Input must be alphanumeric'): Validator =>
(input: string) =>
/^[a-zA-Z0-9]+$/.test(input) ? true : message;
export const alphanumeric = (message = 'Input must be alphanumeric'): Validator => (input: string) =>
/^[a-zA-Z0-9]+$/.test(input) ? true : message;
export const matchRegex =
(validatorRegex : RegExp, message?: string): Validator =>
(input: string) =>
validatorRegex.test(input) ? true : message || `Input does not match the regular expression ${validatorRegex}`;
export const matchRegex = (validatorRegex: RegExp, message?: string): Validator => (input: string) =>
validatorRegex.test(input) ? true : message || `Input does not match the regular expression ${validatorRegex}`;
export const integer =
(message = 'Input must be a number'): Validator =>
(input: string) =>
/^[0-9]+$/.test(input) ? true : message;
export const integer = (message = 'Input must be a number'): Validator => (input: string) => (/^[0-9]+$/.test(input) ? true : message);
export const maxLength =
(maxLen: number, message?: string): Validator =>
(input: string) =>
input.length > maxLen ? message || `Input must be less than ${maxLen} characters long` : true;
export const maxLength = (maxLen: number, message?: string): Validator => (input: string) =>
input.length > maxLen ? message || `Input must be less than ${maxLen} characters long` : true;
export const minLength =
(minLen: number, message?: string): Validator =>
(input: string) =>
input.length < minLen ? message || `Input must be more than ${minLen} characters long` : true;
export const minLength = (minLen: number, message?: string): Validator => (input: string) =>
input.length < minLen ? message || `Input must be more than ${minLen} characters long` : true;
export const exact =
(expected: string, message?: string): Validator =>
(input: string) =>
input === expected ? true : message ?? 'Input does not match expected value';
export const exact = (expected: string, message?: string): Validator => (input: string) =>
input === expected ? true : message ?? 'Input does not match expected value';
export const between = (min: number, max: number, message?: string): Validator => (input: string) =>
parseInt(input) >= min && parseInt(input) <= max ? true : message || `Input must be between ${min} and ${max}`;
/**

@@ -50,13 +40,11 @@ * Logically "and"s several validators

*/
export const and =
(validators: [Validator, Validator, ...Validator[]], message?: string): Validator =>
async (input: string) => {
for (const validator of validators) {
const result = await validator(input);
if (typeof result === 'string') {
return message ?? result;
}
export const and = (validators: [Validator, Validator, ...Validator[]], message?: string): Validator => async (input: string) => {
for (const validator of validators) {
const result = await validator(input);
if (typeof result === 'string') {
return message ?? result;
}
return true;
};
}
return true;
};

@@ -67,14 +55,12 @@ /**

*/
export const or =
(validators: [Validator, Validator, ...Validator[]], message?: string): Validator =>
async (input: string) => {
let result: string | true = true;
for (const validator of validators) {
result = await validator(input);
if (result === true) {
return true;
}
export const or = (validators: [Validator, Validator, ...Validator[]], message?: string): Validator => async (input: string) => {
let result: string | true = true;
for (const validator of validators) {
result = await validator(input);
if (result === true) {
return true;
}
return message ?? result;
};
}
return message ?? result;
};

@@ -85,5 +71,3 @@ /**

*/
export const not =
(validator: Validator, message: string): Validator =>
async (input: string) =>
typeof (await validator(input)) === 'string' ? true : message;
export const not = (validator: Validator, message: string): Validator => async (input: string) =>
typeof (await validator(input)) === 'string' ? true : message;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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