Comparing version 2.1.1 to 2.2.0
export * from './DataGenerators'; | ||
export * from './DomainModule'; | ||
export * from './Strings'; | ||
@@ -3,0 +4,0 @@ export * from './Time'; |
@@ -14,2 +14,3 @@ "use strict"; | ||
__exportStar(require("./DataGenerators"), exports); | ||
__exportStar(require("./DomainModule"), exports); | ||
__exportStar(require("./Strings"), exports); | ||
@@ -16,0 +17,0 @@ __exportStar(require("./Time"), exports); |
@@ -1,2 +0,1 @@ | ||
import { Domain, DomainModule } from 'bf-types'; | ||
export declare function formatFloat(value: number, decimalPlaces?: number | false): string; | ||
@@ -12,4 +11,1 @@ export declare function numberWithCommas(str: string): string; | ||
export declare function toUpperSnakeCase<T extends string = string>(str: string): T; | ||
export declare function domainToUri(domain: Domain): string; | ||
export declare function moduleToUri(module: DomainModule): string; | ||
export declare function validateDomainAndModule(domain: Domain, module: DomainModule): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateDomainAndModule = exports.moduleToUri = exports.domainToUri = exports.toUpperSnakeCase = exports.toLowerSnakeCase = exports.toUpperFirstLetter = exports.toLowerFirstLetter = exports.toUpperCamel = exports.toLowerCamel = exports.toDisplay = exports.formatDecimal = exports.numberWithCommas = exports.formatFloat = void 0; | ||
const bf_types_1 = require("bf-types"); | ||
exports.toUpperSnakeCase = exports.toLowerSnakeCase = exports.toUpperFirstLetter = exports.toLowerFirstLetter = exports.toUpperCamel = exports.toLowerCamel = exports.toDisplay = exports.formatDecimal = exports.numberWithCommas = exports.formatFloat = void 0; | ||
const decimal_js_1 = require("decimal.js"); | ||
@@ -67,39 +66,1 @@ const voca_1 = require("voca"); | ||
exports.toUpperSnakeCase = toUpperSnakeCase; | ||
/* ~~~ String Functions with Application Logic ~~~ */ | ||
const domainUriMap = new Map(); | ||
const moduleUriMap = new Map(); | ||
for (const domain of Object.values(bf_types_1.DOMAINS)) { | ||
domainUriMap.set(domain, toLowerCamel(domain)); | ||
} | ||
for (const module of Object.values(bf_types_1.ALL_MODULES)) { | ||
moduleUriMap.set(module, toLowerCamel(module)); | ||
} | ||
function domainToUri(domain) { | ||
const uri = domainUriMap.get(domain); | ||
if (!uri) { | ||
throw new Error(`There is no URI for the ${domain} domain.`); | ||
} | ||
return uri; | ||
} | ||
exports.domainToUri = domainToUri; | ||
function moduleToUri(module) { | ||
const uri = moduleUriMap.get(module); | ||
if (!uri) { | ||
throw new Error(`There is no URI for the ${module} module.`); | ||
} | ||
return uri; | ||
} | ||
exports.moduleToUri = moduleToUri; | ||
function validateDomainAndModule(domain, module) { | ||
if (!bf_types_1.DOMAINS[domain]) { | ||
throw new Error(`${domain} is not a valid Entity domain`); | ||
} | ||
if (!bf_types_1.ALL_MODULES[module]) { | ||
throw new Error(`${module} is not a valid Entity module`); | ||
} | ||
const domainModules = bf_types_1.DOMAIN_MODULES[domain]; | ||
if (typeof domainModules[module] !== 'string') { | ||
throw new Error(`${module} is not a module of the ${toDisplay(domain)}`); | ||
} | ||
} | ||
exports.validateDomainAndModule = validateDomainAndModule; |
{ | ||
"name": "bf-lib", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"private": false, | ||
@@ -77,3 +77,3 @@ "description": "the standard client library for block-5 software", | ||
"axios": "^0.19.2", | ||
"bf-types": "^3.9.0", | ||
"bf-types": "^3.12.1", | ||
"decimal.js": "^10.2.0", | ||
@@ -85,25 +85,25 @@ "socket.io-client": "^2.3.0", | ||
"devDependencies": { | ||
"@commitlint/cli": "^9.0.1", | ||
"@commitlint/config-conventional": "^9.0.1", | ||
"@commitlint/cli": "^9.1.1", | ||
"@commitlint/config-conventional": "^9.1.1", | ||
"@types/axios": "^0.14.0", | ||
"@types/jest": "^26.0.0", | ||
"@types/node": "^14.0.5", | ||
"@types/jest": "^26.0.5", | ||
"@types/node": "^14.0.24", | ||
"@types/socket.io-client": "^1.4.33", | ||
"@types/voca": "^1.4.0", | ||
"@typescript-eslint/eslint-plugin": "^3.0.0", | ||
"@typescript-eslint/eslint-plugin-tslint": "^3.0.0", | ||
"@typescript-eslint/parser": "^3.0.0", | ||
"@typescript-eslint/eslint-plugin": "^3.7.0", | ||
"@typescript-eslint/eslint-plugin-tslint": "^3.7.0", | ||
"@typescript-eslint/parser": "^3.7.0", | ||
"commitizen": "^4.1.2", | ||
"eslint": "^7.1.0", | ||
"eslint": "^7.5.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"husky": "^4.2.5", | ||
"jest": "^26.0.1", | ||
"lint-staged": "^10.2.6", | ||
"jest": "^26.1.0", | ||
"lint-staged": "^10.2.11", | ||
"prettier": "^2.0.5", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^26.0.0", | ||
"ts-jest": "^26.1.3", | ||
"tslint": "^6.1.2", | ||
"typescript": "^3.9.3" | ||
"typescript": "^3.9.7" | ||
} | ||
} |
84338
71
1924
Updatedbf-types@^3.12.1