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

@medmain/core

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@medmain/core - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

113

dist/browser/esm/locales/english.js

@@ -0,1 +1,4 @@

import capitalize from 'lodash/capitalize';
import isNil from 'lodash/isNil';
import numeral from 'numeral';
export var englishLocale = {

@@ -27,3 +30,111 @@ $id: 'en',

userMenuAdminItemLabel: 'Admin',
userMenuSignOutItemLabel: 'Sign out'
userMenuSignOutItemLabel: 'Sign out',
// === Formatting ===
formatNumber: function formatNumber(number) {
return typeof number === 'number' ? numeral(number).format('0,0.[000]') : '--';
},
formatFileSize: function formatFileSize(size) {
return typeof size === 'number' ? numeral(size).format('0.[0] b') : '--';
},
formatStatus: function formatStatus(status) {
return capitalize((status || '').replace(/_/g, ' '));
},
formatBatchNumber: function formatBatchNumber(number) {
return number ? '#' + number : '--';
},
// === Input fields ===
formatTextInput: function formatTextInput(string) {
return string ? string : '';
},
parseTextInput: function parseTextInput(string) {
return string ? string : null;
},
cleanTextInput: function cleanTextInput(string) {
if (string) {
string = string.trim();
}
return string ? string : null;
},
formatNumberInput: function formatNumberInput(number) {
if (isNil(number)) {
return '';
}
if (typeof number === 'string') {
return number;
}
return String(number);
},
parseNumberInput: function parseNumberInput(string) {
string = string.trim();
if (!string) {
return null;
}
if (string.endsWith('.')) {
return string;
}
var number = Number(string);
if (isNaN(number)) {
return string;
}
return number;
},
numberInputCustomValidity: function numberInputCustomValidity(number) {
if (isNil(number)) {
return '';
}
if (typeof number === 'number' && !isNaN(number)) {
return '';
}
return 'Please enter a valid number.';
},
formatDateInput: function formatDateInput(date) {
if (isNil(date)) {
return '';
}
if (typeof date === 'string') {
return date;
}
var string = date.toISOString();
string = string.slice(0, 4) + '/' + string.slice(5, 7) + '/' + string.slice(8, 10);
return string;
},
parseDateInput: function parseDateInput(string) {
string = string.trim();
if (!string) {
return null;
}
if (string.length !== 10) {
return string;
}
var date = new Date(string.slice(0, 4) + '-' + string.slice(5, 7) + '-' + string.slice(8, 10));
if (isNaN(date.valueOf())) {
return string;
}
return date;
},
dateInputCustomValidity: function dateInputCustomValidity(date) {
if (isNil(date) || date instanceof Date) {
return '';
}
return 'Please enter a valid date.';
},
dateInputPlaceholder: 'YYYY/MM/DD'
};

@@ -5,2 +5,11 @@ "use strict";

exports.englishLocale = void 0;
var _capitalize = _interopRequireDefault(require("lodash/capitalize"));
var _isNil = _interopRequireDefault(require("lodash/isNil"));
var _numeral = _interopRequireDefault(require("numeral"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const englishLocale = {

@@ -32,4 +41,126 @@ $id: 'en',

userMenuAdminItemLabel: 'Admin',
userMenuSignOutItemLabel: 'Sign out'
userMenuSignOutItemLabel: 'Sign out',
// === Formatting ===
formatNumber(number) {
return typeof number === 'number' ? (0, _numeral.default)(number).format('0,0.[000]') : '--';
},
formatFileSize(size) {
return typeof size === 'number' ? (0, _numeral.default)(size).format('0.[0] b') : '--';
},
formatStatus(status) {
return (0, _capitalize.default)((status || '').replace(/_/g, ' '));
},
formatBatchNumber(number) {
return number ? '#' + number : '--';
},
// === Input fields ===
formatTextInput(string) {
return string ? string : '';
},
parseTextInput(string) {
return string ? string : null;
},
cleanTextInput(string) {
if (string) {
string = string.trim();
}
return string ? string : null;
},
formatNumberInput(number) {
if ((0, _isNil.default)(number)) {
return '';
}
if (typeof number === 'string') {
return number;
}
return String(number);
},
parseNumberInput(string) {
string = string.trim();
if (!string) {
return null;
}
if (string.endsWith('.')) {
return string;
}
const number = Number(string);
if (isNaN(number)) {
return string;
}
return number;
},
numberInputCustomValidity(number) {
if ((0, _isNil.default)(number)) {
return '';
}
if (typeof number === 'number' && !isNaN(number)) {
return '';
}
return 'Please enter a valid number.';
},
formatDateInput(date) {
if ((0, _isNil.default)(date)) {
return '';
}
if (typeof date === 'string') {
return date;
}
let string = date.toISOString();
string = string.slice(0, 4) + '/' + string.slice(5, 7) + '/' + string.slice(8, 10);
return string;
},
parseDateInput(string) {
string = string.trim();
if (!string) {
return null;
}
if (string.length !== 10) {
return string;
}
const date = new Date(string.slice(0, 4) + '-' + string.slice(5, 7) + '-' + string.slice(8, 10));
if (isNaN(date.valueOf())) {
return string;
}
return date;
},
dateInputCustomValidity(date) {
if ((0, _isNil.default)(date) || date instanceof Date) {
return '';
}
return 'Please enter a valid date.';
},
dateInputPlaceholder: 'YYYY/MM/DD'
};
exports.englishLocale = englishLocale;

@@ -0,1 +1,4 @@

import capitalize from 'lodash/capitalize';
import isNil from 'lodash/isNil';
import numeral from 'numeral';
export const englishLocale = {

@@ -27,3 +30,125 @@ $id: 'en',

userMenuAdminItemLabel: 'Admin',
userMenuSignOutItemLabel: 'Sign out'
userMenuSignOutItemLabel: 'Sign out',
// === Formatting ===
formatNumber(number) {
return typeof number === 'number' ? numeral(number).format('0,0.[000]') : '--';
},
formatFileSize(size) {
return typeof size === 'number' ? numeral(size).format('0.[0] b') : '--';
},
formatStatus(status) {
return capitalize((status || '').replace(/_/g, ' '));
},
formatBatchNumber(number) {
return number ? '#' + number : '--';
},
// === Input fields ===
formatTextInput(string) {
return string ? string : '';
},
parseTextInput(string) {
return string ? string : null;
},
cleanTextInput(string) {
if (string) {
string = string.trim();
}
return string ? string : null;
},
formatNumberInput(number) {
if (isNil(number)) {
return '';
}
if (typeof number === 'string') {
return number;
}
return String(number);
},
parseNumberInput(string) {
string = string.trim();
if (!string) {
return null;
}
if (string.endsWith('.')) {
return string;
}
const number = Number(string);
if (isNaN(number)) {
return string;
}
return number;
},
numberInputCustomValidity(number) {
if (isNil(number)) {
return '';
}
if (typeof number === 'number' && !isNaN(number)) {
return '';
}
return 'Please enter a valid number.';
},
formatDateInput(date) {
if (isNil(date)) {
return '';
}
if (typeof date === 'string') {
return date;
}
let string = date.toISOString();
string = string.slice(0, 4) + '/' + string.slice(5, 7) + '/' + string.slice(8, 10);
return string;
},
parseDateInput(string) {
string = string.trim();
if (!string) {
return null;
}
if (string.length !== 10) {
return string;
}
const date = new Date(string.slice(0, 4) + '-' + string.slice(5, 7) + '-' + string.slice(8, 10));
if (isNaN(date.valueOf())) {
return string;
}
return date;
},
dateInputCustomValidity(date) {
if (isNil(date) || date instanceof Date) {
return '';
}
return 'Please enter a valid date.';
},
dateInputPlaceholder: 'YYYY/MM/DD'
};

4

package.json
{
"name": "@medmain/core",
"version": "0.1.8",
"version": "0.1.9",
"description": "Medmain's core module, root of everything else",

@@ -14,2 +14,4 @@ "files": [

"dot-prop": "^4.2.0",
"lodash": "^4.17.10",
"numeral": "^2.0.6",
"object-tojson": "^1.0.1"

@@ -16,0 +18,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