From 882aa084249fc533b06e65f2d584617ac1ef4edf Mon Sep 17 00:00:00 2001 From: David Kebler Date: Mon, 16 Mar 2020 10:52:12 -0700 Subject: [PATCH] 0.5.1 reworked getting database path from config file to be more flexible and to override by env var major improvements to upgrade code for v2+ deploy of 645. Cleans with simple git if need be uses cast, typeOf and check from utils to better set values reworked systemd now to two unit files only --- package.json | 2 +- readme.md | 2 +- src/check.js | 4 +++- src/index.js | 2 +- test/check.test.js | 8 +++++++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index dfd6b48..4074985 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@uci-utils/type", - "version": "0.5.0", + "version": "0.5.1", "description": "A variable type check and casting utility - extension of typechecker package plus type casting", "main": "src/", "scripts": { diff --git a/readme.md b/readme.md index 22287fc..1cd9885 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ All includes some simple type casting including using uci to-boolean for boolean See type checker api http://master.typechecker.bevry.surge.sh/docs/ -exentions are +extensions are `.isPromise` `.isBuffer` diff --git a/src/check.js b/src/check.js index 51d4e37..0abc16b 100644 --- a/src/check.js +++ b/src/check.js @@ -25,5 +25,7 @@ customTypeChecker.getType = function customGetType(value, _typeMap) { return typechecker.getType(value, _typeMap || customTypeMap) } +const typeOf = customTypeChecker.getType + export default customTypeChecker -export { customTypeChecker as check } +export { customTypeChecker as check, typeOf } diff --git a/src/index.js b/src/index.js index 189a00e..ad9f198 100644 --- a/src/index.js +++ b/src/index.js @@ -2,5 +2,5 @@ import check from './check' export * from './cast' -export { check } from './check' +export { check, typeOf } from './check' export default check // default is just the typechecker only diff --git a/test/check.test.js b/test/check.test.js index 078398c..2e6200f 100644 --- a/test/check.test.js +++ b/test/check.test.js @@ -1,5 +1,5 @@ import { expect } from 'chai' -import u from '../src' +import u, {typeOf} from '../src' describe('Type Check Library - ', function () { @@ -10,6 +10,12 @@ describe('Type Check Library - ', function () { expect(u.getType(Promise.resolve(2))).to.equal('promise') }) + it('Should export typeOf for .getType', function () { + expect(typeOf(typeOf)).to.equal('function') + }) + + console.log(typeOf(typeOf)) + it('Should include typechecker methods', function () { expect(u.isPlainObject([1])).to.equal(false) expect(u.getType(true)).to.equal('boolean')