@traveloka/validation
Advanced tools
Comparing version 3.4.5 to 3.5.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.5.0](https://github.com/traveloka/react-schema/compare/v3.4.6...v3.5.0) (2023-12-01) | ||
### Features | ||
* useFormState ([#97](https://github.com/traveloka/react-schema/issues/97)) ([3f665ea](https://github.com/traveloka/react-schema/commit/3f665eaa6234d148317a803414c5c730c726e8aa)) | ||
## [3.4.5](https://github.com/traveloka/react-schema/compare/v3.4.5-alpha.0...v3.4.5) (2021-12-17) | ||
@@ -8,0 +19,0 @@ |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./required")); | ||
__export(require("./validate")); | ||
__export(require("./maxLength")); | ||
__export(require("./or")); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./required"), exports); | ||
__exportStar(require("./validate"), exports); | ||
__exportStar(require("./maxLength"), exports); | ||
__exportStar(require("./or"), exports); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.maxLength = function (n) { return function (value, errorMessage) { | ||
exports.maxLength = void 0; | ||
var maxLength = function (n) { return function (value, errorMessage) { | ||
if (value.length > n) | ||
return errorMessage || "Length must less than " + n; | ||
return errorMessage || "Length must less than ".concat(n); | ||
return null; | ||
}; }; | ||
exports.maxLength = maxLength; | ||
//# sourceMappingURL=maxLength.js.map |
import { Rule } from "./types/Validate"; | ||
import { Validation } from "./types"; | ||
declare type Or = (rule: Rule) => Validation; | ||
type Or = (rule: Rule) => Validation; | ||
export declare const or: Or; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.or = void 0; | ||
var validate_1 = require("./validate"); | ||
var INITIAL_RESULT = 'ulet-si-tukang-pos'; | ||
exports.or = function (rule) { | ||
var or = function (rule) { | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
@@ -11,3 +12,3 @@ var rulesWithOrCondition = function (value) { | ||
return errorMessage; | ||
return validate_1.validate(currRule)(value); | ||
return (0, validate_1.validate)(currRule)(value); | ||
}, INITIAL_RESULT); | ||
@@ -20,2 +21,3 @@ if (result === INITIAL_RESULT) | ||
}; | ||
exports.or = or; | ||
//# sourceMappingURL=or.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.required = function (value, errorMessage) { | ||
exports.required = void 0; | ||
var required = function (value, errorMessage) { | ||
if (value === null || | ||
@@ -12,2 +13,3 @@ value === undefined || | ||
}; | ||
exports.required = required; | ||
//# sourceMappingURL=required.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./ValidationResult"), exports); | ||
__exportStar(require("./Validation"), exports); | ||
__exportStar(require("./Validate"), exports); | ||
//# sourceMappingURL=index.js.map |
import { Validation } from "./Validation"; | ||
import { ValidationResult } from "./ValidationResult"; | ||
export declare type Rule = Validation | Rules; | ||
export type Rule = Validation | Rules; | ||
export interface Rules extends Array<Rule> { | ||
} | ||
export declare type Validate = (rule: Rule) => (value: any, ...args: any[]) => ValidationResult; | ||
export type Validate = (rule: Rule) => (value: any, ...args: any[]) => ValidationResult; |
import { ValidationResult } from "./ValidationResult"; | ||
export declare type Validation = (v: any, ...args: any[]) => ValidationResult; | ||
export type Validation = (v: any, ...args: any[]) => ValidationResult; |
@@ -1,1 +0,1 @@ | ||
export declare type ValidationResult = string | null; | ||
export type ValidationResult = string | null; |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validate = function (rule) { return function (value) { | ||
exports.validate = void 0; | ||
var validate = function (rule) { return function (value) { | ||
var args = []; | ||
@@ -9,3 +19,3 @@ for (var _i = 1; _i < arguments.length; _i++) { | ||
if (!Array.isArray(rule)) | ||
return rule.apply(void 0, [value].concat(args)); | ||
return rule.apply(void 0, __spreadArray([value], args, false)); | ||
var rules = rule; | ||
@@ -15,6 +25,7 @@ var result = rules.reduce(function (errorMessage, currRule) { | ||
return errorMessage; | ||
return exports.validate(currRule).apply(void 0, [value].concat(args)); | ||
return (0, exports.validate)(currRule).apply(void 0, __spreadArray([value], args, false)); | ||
}, null); | ||
return result; | ||
}; }; | ||
exports.validate = validate; | ||
//# sourceMappingURL=validate.js.map |
{ | ||
"name": "@traveloka/validation", | ||
"version": "3.4.5", | ||
"version": "3.5.0", | ||
"main": "lib/index.js", | ||
@@ -29,3 +29,3 @@ "types": "./lib/index.d.ts", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.0.1" | ||
"typescript": "^4" | ||
}, | ||
@@ -35,3 +35,3 @@ "jest": { | ||
"transform": { | ||
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
".(ts|tsx)": "ts-jest" | ||
}, | ||
@@ -38,0 +38,0 @@ "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", |
@@ -8,3 +8,3 @@ { | ||
"target": "es5", | ||
"lib": ["es6", "es2017", "dom"], | ||
"lib": ["es6", "es2017"], | ||
"sourceMap": true, | ||
@@ -19,6 +19,3 @@ "jsx": "react", | ||
"include": ["src/**/*.ts", "src/**/*.tsx"], | ||
"exclude": ["src/**/__tests__/*.ts", "src/**/__tests__/*.tsx"], | ||
"types": [ | ||
"typePatches" | ||
] | ||
"exclude": ["src/**/__tests__/*.ts", "src/**/__tests__/*.tsx"] | ||
} |
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
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
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
105937
63
965
1