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 1.6.3-mapsto2.0 to 1.6.3-mapsto3.0

7

CHANGELOG.md

@@ -6,10 +6,13 @@ # Change Log

## [1.6.3-mapsto2.0](https://github.com/aws-amplify/amplify-cli/compare/amplify-prompts@1.6.2...amplify-prompts@1.6.3-mapsto2.0) (2022-01-18)
## [1.6.3-mapsto3.0](https://github.com/aws-amplify/amplify-cli/compare/amplify-prompts@1.6.2...amplify-prompts@1.6.3-mapsto3.0) (2022-01-26)
**Note:** Version bump only for package amplify-prompts
### Bug Fixes
* validation for s3 bucketname in s3-cli walkthrough ([#9555](https://github.com/aws-amplify/amplify-cli/issues/9555)) ([1daf720](https://github.com/aws-amplify/amplify-cli/commit/1daf72029bda79645ee95997c40a887741499164))
## [1.6.2](https://github.com/aws-amplify/amplify-cli/compare/amplify-prompts@1.6.0...amplify-prompts@1.6.2) (2022-01-10)

@@ -16,0 +19,0 @@

export declare type Validator = (value: string) => true | string | Promise<true | string>;
export declare const alphanumeric: (message?: string) => Validator;
export declare const matchRegex: (validatorRegex: RegExp, message?: string | undefined) => Validator;
export declare const integer: (message?: string) => Validator;

@@ -4,0 +5,0 @@ export declare const maxLength: (maxLen: number, 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.alphanumeric = void 0;
exports.not = exports.or = exports.and = 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;
exports.alphanumeric = alphanumeric;
const matchRegex = (validatorRegex, message) => (input) => validatorRegex.test(input) ? true : message || `Input does not match the regular expression ${validatorRegex}`;
exports.matchRegex = matchRegex;
const integer = (message = 'Input must be a number') => (input) => /^[0-9]+$/.test(input) ? true : message;

@@ -7,0 +9,0 @@ exports.integer = integer;

{
"name": "amplify-prompts",
"version": "1.6.3-mapsto2.0",
"version": "1.6.3-mapsto3.0",
"description": "Utility functions for Amplify CLI terminal I/O",

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

},
"gitHead": "9fc94912534716afe496e0616fd72656069f6378"
"gitHead": "2413916fb0ebf8e8318c3e9beba4c9aac7f40875"
}

@@ -1,2 +0,2 @@

import { alphanumeric, and, integer, maxLength, minLength, not, or } from '../validators';
import { alphanumeric, and, integer, maxLength, minLength, not, or, matchRegex } from '../validators';

@@ -108,1 +108,19 @@ describe('alphanumeric', () => {

});
describe('regexpValidator', () => {
it('returns true for strings matching regexp', () => {
expect(matchRegex(/^[a-z0-9-]+$/, 'regExp test')('test-logs-20220118')).toBe(true);
});
it('returns default error message for strings not matching regexp', () => {
expect(matchRegex(/^[a-z0-9-]+$/, undefined)('test_logs_*')).toMatchInlineSnapshot(
`"Input does not match the regular expression /^[a-z0-9-]+$/"`,
);
});
it('returns specified error message for strings not matching regexp', () => {
expect(matchRegex(/^[a-z0-9-]+$/, 'Only alphanumeric chars and hyphen allowed in string')('test_logs_*')).toMatchInlineSnapshot(
`"Only alphanumeric chars and hyphen allowed in string"`,
);
});
});

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

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 =

@@ -22,0 +27,0 @@ (message: string = 'Input must be a number'): Validator =>

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