@talend/utils
Advanced tools
Comparing version 2.0.0 to 2.0.1
# @talend/utils | ||
## 2.0.1 | ||
### Patch Changes | ||
- 039b85775: chore: upgrade dependencies and align @talend scoped packages to latest | ||
## 2.0.0 | ||
@@ -4,0 +10,0 @@ |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.format = exports.FORMAT = exports.timeZoneExists = exports.convertToUTC = exports.formatToTimeZone = exports.convertToTimeZone = exports.convertToLocalTime = exports.formatReadableUTCOffset = exports.getUTCOffset = void 0; | ||
var format_1 = __importDefault(require("date-fns/format")); | ||
var parse_1 = __importDefault(require("date-fns/parse")); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.FORMAT = void 0; | ||
exports.convertToLocalTime = convertToLocalTime; | ||
exports.convertToTimeZone = convertToTimeZone; | ||
exports.convertToUTC = convertToUTC; | ||
exports.default = void 0; | ||
exports.format = format; | ||
exports.formatReadableUTCOffset = formatReadableUTCOffset; | ||
exports.formatToTimeZone = formatToTimeZone; | ||
exports.getUTCOffset = getUTCOffset; | ||
exports.timeZoneExists = timeZoneExists; | ||
var _format = _interopRequireDefault(require("date-fns/format")); | ||
var _parse = _interopRequireDefault(require("date-fns/parse")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -29,21 +31,24 @@ * Get the offset between a timezone and the UTC time (in minutes) | ||
function getUTCOffset(timeZone) { | ||
// Build localized formats for UTC and the target timezone | ||
var formatOptions = { | ||
year: 'numeric', | ||
month: 'numeric', | ||
day: 'numeric', | ||
hour: 'numeric', | ||
minute: 'numeric', | ||
}; | ||
var locale = 'en-US'; | ||
var utcFormat = new Intl.DateTimeFormat(locale, __assign(__assign({}, formatOptions), { timeZone: 'Etc/UTC' })); | ||
var timezoneFormat = new Intl.DateTimeFormat(locale, __assign(__assign({}, formatOptions), { timeZone: timeZone })); | ||
// Create the same date in UTC timezone and the target timezone | ||
var date = new Date(); | ||
var utcDate = new Date(utcFormat.format(date)); | ||
var timezoneDate = new Date(timezoneFormat.format(date)); | ||
// Compute delta between dates | ||
return (timezoneDate.getTime() - utcDate.getTime()) / (1000 * 60); | ||
// Build localized formats for UTC and the target timezone | ||
const formatOptions = { | ||
year: 'numeric', | ||
month: 'numeric', | ||
day: 'numeric', | ||
hour: 'numeric', | ||
minute: 'numeric' | ||
}; | ||
const locale = 'en-US'; | ||
const utcFormat = new Intl.DateTimeFormat(locale, { ...formatOptions, | ||
timeZone: 'Etc/UTC' | ||
}); | ||
const timezoneFormat = new Intl.DateTimeFormat(locale, { ...formatOptions, | ||
timeZone | ||
}); // Create the same date in UTC timezone and the target timezone | ||
const date = new Date(); | ||
const utcDate = new Date(utcFormat.format(date)); | ||
const timezoneDate = new Date(timezoneFormat.format(date)); // Compute delta between dates | ||
return (timezoneDate.getTime() - utcDate.getTime()) / (1000 * 60); | ||
} | ||
exports.getUTCOffset = getUTCOffset; | ||
/** | ||
@@ -55,10 +60,12 @@ * Format an UTC offset from minutes to [+/-][HH][separator][mm] | ||
*/ | ||
function formatUTCOffset(offset, separator) { | ||
var sign = offset >= 0 ? '+' : '-'; | ||
var absoluteOffset = Math.abs(offset); | ||
var min = absoluteOffset % 60; | ||
var hours = (absoluteOffset - min) / 60; | ||
var paddedHours = hours.toString().padStart(2, '0'); | ||
var paddedMin = min.toString().padStart(2, '0'); | ||
return "" + sign + paddedHours + separator + paddedMin; | ||
const sign = offset >= 0 ? '+' : '-'; | ||
const absoluteOffset = Math.abs(offset); | ||
const min = absoluteOffset % 60; | ||
const hours = (absoluteOffset - min) / 60; | ||
const paddedHours = hours.toString().padStart(2, '0'); | ||
const paddedMin = min.toString().padStart(2, '0'); | ||
return `${sign}${paddedHours}${separator}${paddedMin}`; | ||
} | ||
@@ -70,6 +77,7 @@ /** | ||
*/ | ||
function formatReadableUTCOffset(offset) { | ||
return formatUTCOffset(offset, ':'); | ||
return formatUTCOffset(offset, ':'); | ||
} | ||
exports.formatReadableUTCOffset = formatReadableUTCOffset; | ||
/** | ||
@@ -85,8 +93,10 @@ * Replace timezone token(s) in the date format pattern to a specific timezone's value(s). | ||
*/ | ||
function formatTimeZoneTokens(dateFormat, timeZone) { | ||
return dateFormat.replace(/(z|ZZ?)(?!\])/g, function (match) { | ||
var offset = getUTCOffset(timeZone); | ||
var separator = match === 'Z' ? ':' : ''; | ||
return formatUTCOffset(offset, separator); | ||
}); | ||
return dateFormat.replace(/(z|ZZ?)(?!\])/g, match => { | ||
const offset = getUTCOffset(timeZone); | ||
const separator = match === 'Z' ? ':' : ''; | ||
return formatUTCOffset(offset, separator); | ||
}); | ||
} | ||
@@ -101,8 +111,9 @@ /** | ||
*/ | ||
function convertToLocalTime(date, options) { | ||
var parsedDate = (0, parse_1.default)(date); | ||
var offset = getUTCOffset(options.timeZone) + parsedDate.getTimezoneOffset(); | ||
return new Date(parsedDate.getTime() - offset * 60 * 1000); | ||
const parsedDate = (0, _parse.default)(date); | ||
const offset = getUTCOffset(options.timeZone) + parsedDate.getTimezoneOffset(); | ||
return new Date(parsedDate.getTime() - offset * 60 * 1000); | ||
} | ||
exports.convertToLocalTime = convertToLocalTime; | ||
/** | ||
@@ -117,13 +128,19 @@ * Converts the given date from the local time (or from specified source timezone) to | ||
*/ | ||
function convertToTimeZone(date, options) { | ||
var timeZone = options.timeZone, sourceTimeZone = options.sourceTimeZone; | ||
var parsedDate = (0, parse_1.default)(date); | ||
var offset = getUTCOffset(timeZone) + parsedDate.getTimezoneOffset(); | ||
if (sourceTimeZone) { | ||
offset -= new Date().getTimezoneOffset(); | ||
offset -= getUTCOffset(sourceTimeZone); | ||
} | ||
return new Date(parsedDate.getTime() + offset * 60 * 1000); | ||
const { | ||
timeZone, | ||
sourceTimeZone | ||
} = options; | ||
const parsedDate = (0, _parse.default)(date); | ||
let offset = getUTCOffset(timeZone) + parsedDate.getTimezoneOffset(); | ||
if (sourceTimeZone) { | ||
offset -= new Date().getTimezoneOffset(); | ||
offset -= getUTCOffset(sourceTimeZone); | ||
} | ||
return new Date(parsedDate.getTime() + offset * 60 * 1000); | ||
} | ||
exports.convertToTimeZone = convertToTimeZone; | ||
/** | ||
@@ -138,9 +155,10 @@ * Returns the formatted date string in the given format, after converting it to the given time zone. | ||
*/ | ||
function formatToTimeZone(date, formatString, options) { | ||
var dateConvertedToTimezone = convertToTimeZone(date, options); | ||
// Replace timezone token(s) in the string format with timezone values, since format() will use local timezone | ||
var dateFnsFormatWithTimeZoneValue = formatTimeZoneTokens(formatString, options.timeZone); | ||
return (0, format_1.default)(dateConvertedToTimezone, dateFnsFormatWithTimeZoneValue); | ||
const dateConvertedToTimezone = convertToTimeZone(date, options); // Replace timezone token(s) in the string format with timezone values, since format() will use local timezone | ||
const dateFnsFormatWithTimeZoneValue = formatTimeZoneTokens(formatString, options.timeZone); | ||
return (0, _format.default)(dateConvertedToTimezone, dateFnsFormatWithTimeZoneValue); | ||
} | ||
exports.formatToTimeZone = formatToTimeZone; | ||
/** | ||
@@ -152,6 +170,7 @@ * Convert a date in local TZ to UTC | ||
*/ | ||
function convertToUTC(date) { | ||
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds())); | ||
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds())); | ||
} | ||
exports.convertToUTC = convertToUTC; | ||
/** | ||
@@ -162,13 +181,15 @@ * Check wether a timezone exists or not. | ||
*/ | ||
function timeZoneExists(timeZone) { | ||
try { | ||
// eslint-disable-next-line no-new | ||
new Intl.DateTimeFormat(undefined, { timeZone: timeZone }); | ||
return true; | ||
} | ||
catch (e) { | ||
return false; | ||
} | ||
try { | ||
// eslint-disable-next-line no-new | ||
new Intl.DateTimeFormat(undefined, { | ||
timeZone | ||
}); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
exports.timeZoneExists = timeZoneExists; | ||
/** | ||
@@ -178,18 +199,38 @@ * Date format options | ||
*/ | ||
exports.FORMAT = { | ||
/** en: June 29, 2021 / fr: 29 juin 2020 / ja: 2020年6月29日 / de 29. Juni 2020 */ | ||
MDY_LONG: 'MDY_LONG', | ||
/** en: June 2020 / fr: juin 2020 / ja: 2020年6月 / Juni 2020 */ | ||
MY_LONG: 'MY_LONG', | ||
/** en: 06/29/2020 / fr: 29/06/2020 / ja: 2020/06/29 / de: 29.06.2020 */ | ||
MDY: 'MDY', | ||
/** en: 6/29/20, 10:00 PM / fr: 29/06/2020 22:00 / ja: 2020/06/29 22:00 / de: 29.06.20, 22:00 */ | ||
MDYHM: 'MDYHM', | ||
const FORMAT = { | ||
/** en: June 29, 2021 / fr: 29 juin 2020 / ja: 2020年6月29日 / de 29. Juni 2020 */ | ||
MDY_LONG: 'MDY_LONG', | ||
/** en: June 2020 / fr: juin 2020 / ja: 2020年6月 / Juni 2020 */ | ||
MY_LONG: 'MY_LONG', | ||
/** en: 06/29/2020 / fr: 29/06/2020 / ja: 2020/06/29 / de: 29.06.2020 */ | ||
MDY: 'MDY', | ||
/** en: 6/29/20, 10:00 PM / fr: 29/06/2020 22:00 / ja: 2020/06/29 22:00 / de: 29.06.20, 22:00 */ | ||
MDYHM: 'MDYHM' | ||
}; | ||
var options = (_a = {}, | ||
_a[exports.FORMAT.MDY_LONG] = { year: 'numeric', month: 'long', day: 'numeric' }, | ||
_a[exports.FORMAT.MY_LONG] = { year: 'numeric', month: 'long' }, | ||
_a[exports.FORMAT.MDY] = { year: 'numeric', month: '2-digit', day: '2-digit' }, | ||
_a[exports.FORMAT.MDYHM] = { dateStyle: 'short', timeStyle: 'short' }, | ||
_a); | ||
exports.FORMAT = FORMAT; | ||
const options = { | ||
[FORMAT.MDY_LONG]: { | ||
year: 'numeric', | ||
month: 'long', | ||
day: 'numeric' | ||
}, | ||
[FORMAT.MY_LONG]: { | ||
year: 'numeric', | ||
month: 'long' | ||
}, | ||
[FORMAT.MDY]: { | ||
year: 'numeric', | ||
month: '2-digit', | ||
day: '2-digit' | ||
}, | ||
[FORMAT.MDYHM]: { | ||
dateStyle: 'short', | ||
timeStyle: 'short' | ||
} | ||
}; | ||
/** | ||
@@ -202,18 +243,20 @@ * Format a date using Intl. | ||
*/ | ||
function format(date, dateOption, lang) { | ||
return new Intl.DateTimeFormat(lang, options[dateOption]).format((0, parse_1.default)(date)); | ||
return new Intl.DateTimeFormat(lang, options[dateOption]).format((0, _parse.default)(date)); | ||
} | ||
exports.format = format; | ||
; | ||
exports.default = { | ||
convertToLocalTime: convertToLocalTime, | ||
convertToTimeZone: convertToTimeZone, | ||
convertToUTC: convertToUTC, | ||
format: format, | ||
FORMAT: exports.FORMAT, | ||
formatReadableUTCOffset: formatReadableUTCOffset, | ||
formatToTimeZone: formatToTimeZone, | ||
getUTCOffset: getUTCOffset, | ||
timeZoneExists: timeZoneExists, | ||
var _default = { | ||
convertToLocalTime, | ||
convertToTimeZone, | ||
convertToUTC, | ||
format, | ||
FORMAT, | ||
formatReadableUTCOffset, | ||
formatToTimeZone, | ||
getUTCOffset, | ||
timeZoneExists | ||
}; | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validation = exports.date = void 0; | ||
var date_1 = __importDefault(require("./date")); | ||
exports.date = date_1.default; | ||
var validation_1 = __importDefault(require("./validation")); | ||
exports.validation = validation_1.default; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "date", { | ||
enumerable: true, | ||
get: function () { | ||
return _date.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "validation", { | ||
enumerable: true, | ||
get: function () { | ||
return _validation.default; | ||
} | ||
}); | ||
var _date = _interopRequireDefault(require("./date")); | ||
var _validation = _interopRequireDefault(require("./validation")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
exports.default = void 0; | ||
var REGEXP = _interopRequireWildcard(require("./regexp")); | ||
var methods = _interopRequireWildcard(require("./methods")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var _default = { | ||
REGEXP, | ||
...methods | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var REGEXP = __importStar(require("./regexp")); | ||
var methods = __importStar(require("./methods")); | ||
exports.default = __assign({ REGEXP: REGEXP }, methods); | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validPhone = exports.validDomain = exports.validEmail = exports.validLastName = exports.validFirstName = void 0; | ||
var regexp_1 = require("./regexp"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.validPhone = exports.validLastName = exports.validFirstName = exports.validEmail = exports.validDomain = void 0; | ||
var _regexp = require("./regexp"); | ||
/** | ||
@@ -11,3 +16,3 @@ * Build a validation method along a given regular expression | ||
function getValidationMethod(regexp) { | ||
return function (value) { return regexp.test(value); }; | ||
return value => regexp.test(value); | ||
} | ||
@@ -19,3 +24,5 @@ /** | ||
*/ | ||
exports.validFirstName = getValidationMethod(regexp_1.NAME); | ||
const validFirstName = getValidationMethod(_regexp.NAME); | ||
/** | ||
@@ -26,3 +33,5 @@ * Check that a given value is a valid last name | ||
*/ | ||
exports.validLastName = getValidationMethod(regexp_1.NAME); | ||
exports.validFirstName = validFirstName; | ||
const validLastName = getValidationMethod(_regexp.NAME); | ||
/** | ||
@@ -33,3 +42,5 @@ * Check that a given value is a value email address | ||
*/ | ||
exports.validEmail = getValidationMethod(regexp_1.EMAIL); | ||
exports.validLastName = validLastName; | ||
const validEmail = getValidationMethod(_regexp.EMAIL); | ||
/** | ||
@@ -40,3 +51,5 @@ * Check that a given value is a valid domain | ||
*/ | ||
exports.validDomain = getValidationMethod(regexp_1.DOMAIN); | ||
exports.validEmail = validEmail; | ||
const validDomain = getValidationMethod(_regexp.DOMAIN); | ||
/** | ||
@@ -47,3 +60,6 @@ * Check that a given value is a valid phone number | ||
*/ | ||
exports.validPhone = getValidationMethod(regexp_1.PHONE); | ||
exports.validDomain = validDomain; | ||
const validPhone = getValidationMethod(_regexp.PHONE); | ||
exports.validPhone = validPhone; | ||
//# sourceMappingURL=methods.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.PHONE = exports.NAME = exports.EMAIL = exports.DOMAIN = void 0; | ||
/* eslint-disable no-useless-escape */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DOMAIN = exports.NAME = exports.EMAIL = exports.PHONE = void 0; | ||
exports.PHONE = /^((?:\+[\d().-]*\d[\d().-]*|[0-9A-F*#().-]*[0-9A-F*#][0-9A-F*#().-]*(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&+$_!~*'().-]|%[\dA-F]{2})+)?)*;phone-context=(?:\+[\d().-]*\d[\d().-]*|(?:[a-z0-9]\.|[a-z0-9][a-z0-9-]*[a-z0-9]\.)*(?:[a-z]|[a-z][a-z0-9-]*[a-z0-9])))(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&+$_!~*'().-]|%[\dA-F]{2})+)?)*(?:,(?:\+[\d().-]*\d[\d().-]*|[0-9A-F*#().-]*[0-9A-F*#][0-9A-F*#().-]*(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&+$_!~*'().-]|%[\dA-F]{2})+)?)*;?)*)*)$/; | ||
exports.EMAIL = /^\s*[^ @]+@[^ @]+\s*$/; | ||
exports.NAME = /^[^\~!@#$%^&*()|+=?;:",<>\{\}\[\]\\\/¤€¨£°§]*$/i; | ||
exports.DOMAIN = /^[^\~!#$%^&*()|+=?;:",<>\{\}\[\]\\\/¤€¨£°§]*$/i; | ||
const PHONE = /^((?:\+[\d().-]*\d[\d().-]*|[0-9A-F*#().-]*[0-9A-F*#][0-9A-F*#().-]*(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&+$_!~*'().-]|%[\dA-F]{2})+)?)*;phone-context=(?:\+[\d().-]*\d[\d().-]*|(?:[a-z0-9]\.|[a-z0-9][a-z0-9-]*[a-z0-9]\.)*(?:[a-z]|[a-z][a-z0-9-]*[a-z0-9])))(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&+$_!~*'().-]|%[\dA-F]{2})+)?)*(?:,(?:\+[\d().-]*\d[\d().-]*|[0-9A-F*#().-]*[0-9A-F*#][0-9A-F*#().-]*(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&+$_!~*'().-]|%[\dA-F]{2})+)?)*;?)*)*)$/; | ||
exports.PHONE = PHONE; | ||
const EMAIL = /^\s*[^ @]+@[^ @]+\s*$/; | ||
exports.EMAIL = EMAIL; | ||
const NAME = /^[^\~!@#$%^&*()|+=?;:",<>\{\}\[\]\\\/¤€¨£°§]*$/i; | ||
exports.NAME = NAME; | ||
const DOMAIN = /^[^\~!#$%^&*()|+=?;:",<>\{\}\[\]\\\/¤€¨£°§]*$/i; | ||
/* eslint-enable no-useless-escape */ | ||
exports.DOMAIN = DOMAIN; | ||
//# sourceMappingURL=regexp.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.validPhones = exports.validNames = exports.validEmails = exports.invalidPhones = exports.invalidNames = exports.invalidEmails = void 0; | ||
// List of values used in the tests | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.invalidPhones = exports.validPhones = exports.invalidEmails = exports.validEmails = exports.invalidNames = exports.validNames = void 0; | ||
// Names | ||
exports.validNames = [ | ||
'Sarah', | ||
'sarah-bernard', | ||
'John Doe', | ||
'Charles the 3rd', | ||
'John Sr.', | ||
'Іванна', | ||
'Αλέξης', | ||
'佐藤', | ||
]; | ||
exports.invalidNames = [ | ||
'Jo@hn', | ||
'Jo#hn', | ||
'Jo$hn', | ||
'Jo%hn', | ||
'Jo^hn', | ||
'Jo&hn', | ||
'Jo(hn', | ||
'Jo)hn', | ||
'Jo|hn', | ||
'Jo=hn', | ||
'Jo?hn', | ||
'Jo;hn', | ||
'Sa:ra', | ||
'Sa,ra', | ||
'Sa&ra', | ||
'Sa¤ra', | ||
'Sa€ra', | ||
'Sa¨ra', | ||
'Sa£ra', | ||
'Sa"ra', | ||
'Sa°ra', | ||
'Sa§ra', | ||
'Sa*ra', | ||
]; | ||
// Emails | ||
exports.validEmails = [ | ||
'sarah@something', | ||
'sarah@something.fr', | ||
]; | ||
exports.invalidEmails = [ | ||
'john', | ||
'john@', | ||
'john @', | ||
]; | ||
// Phones | ||
exports.validPhones = [ | ||
'+33102030405', | ||
]; | ||
exports.invalidPhones = [ | ||
'john', | ||
'john@', | ||
'john @', | ||
'sarah@something.fr', | ||
'Fred', | ||
]; | ||
const validNames = ['Sarah', 'sarah-bernard', 'John Doe', 'Charles the 3rd', 'John Sr.', 'Іванна', 'Αλέξης', '佐藤']; | ||
exports.validNames = validNames; | ||
const invalidNames = ['Jo@hn', 'Jo#hn', 'Jo$hn', 'Jo%hn', 'Jo^hn', 'Jo&hn', 'Jo(hn', 'Jo)hn', 'Jo|hn', 'Jo=hn', 'Jo?hn', 'Jo;hn', 'Sa:ra', 'Sa,ra', 'Sa&ra', 'Sa¤ra', 'Sa€ra', 'Sa¨ra', 'Sa£ra', 'Sa"ra', 'Sa°ra', 'Sa§ra', 'Sa*ra']; // Emails | ||
exports.invalidNames = invalidNames; | ||
const validEmails = ['sarah@something', 'sarah@something.fr']; | ||
exports.validEmails = validEmails; | ||
const invalidEmails = ['john', 'john@', 'john @']; // Phones | ||
exports.invalidEmails = invalidEmails; | ||
const validPhones = ['+33102030405']; | ||
exports.validPhones = validPhones; | ||
const invalidPhones = ['john', 'john@', 'john @', 'sarah@something.fr', 'Fred']; | ||
exports.invalidPhones = invalidPhones; | ||
//# sourceMappingURL=testValues.js.map |
{ | ||
"name": "@talend/utils", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Various utilities", | ||
@@ -24,5 +24,5 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@talend/scripts-core": "^11.0.1", | ||
"@talend/scripts-preset-react-lib": "^9.9.2", | ||
"@typescript-eslint/parser": "^4.32.0", | ||
"@talend/scripts-core": "^11.3.0", | ||
"@talend/scripts-preset-react-lib": "^9.9.3", | ||
"@typescript-eslint/parser": "^4.33.0", | ||
"cross-env": "^7.0.3" | ||
@@ -36,2 +36,2 @@ }, | ||
} | ||
} | ||
} |
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
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
83260
1209