noodl-types
Advanced tools
Comparing version 1.0.18 to 1.0.19
@@ -8,18 +8,39 @@ "use strict"; | ||
var chai_1 = require("chai"); | ||
var identify_1 = require("../identify"); | ||
describe("identify", function () { | ||
describe("" + chalk_1.default.keyword('hotpink')('toast'), function () { | ||
var Identify_1 = require("../Identify"); | ||
describe(chalk_1.default.keyword('orange')('identify'), function () { | ||
describe.only("actionChain", function () { | ||
it.only("should accept emit objects", function () { | ||
chai_1.expect(Identify_1.identify.actionChain([ | ||
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] }, | ||
])).to.be.true; | ||
}); | ||
xit("should accept goto objects", function () { | ||
chai_1.expect(Identify_1.identify.actionChain([ | ||
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] }, | ||
{ goto: 'PatientDashboard' }, | ||
{ toast: { message: 'Hello' } }, | ||
])).to.be.true; | ||
}); | ||
xit("should accept emit, goto, and toast objects", function () { | ||
chai_1.expect(Identify_1.identify.actionChain([ | ||
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] }, | ||
{ goto: 'PatientDashboard' }, | ||
{ toast: { message: 'Hello' } }, | ||
])).to.be.true; | ||
}); | ||
}); | ||
describe("toast", function () { | ||
it("should be a toast", function () { | ||
chai_1.expect(identify_1.identify.toast({ toast: { message: 'hello', style: {} } })).to.be | ||
chai_1.expect(Identify_1.identify.toast({ toast: { message: 'hello', style: {} } })).to.be | ||
.true; | ||
}); | ||
it("should not be a toast", function () { | ||
chai_1.expect(identify_1.identify.toast({ toasft: { message: 'hello', style: {} } })).to.be | ||
chai_1.expect(Identify_1.identify.toast({ toasft: { message: 'hello', style: {} } })).to.be | ||
.false; | ||
chai_1.expect(identify_1.identify.toast({})).to.be.false; | ||
chai_1.expect(identify_1.identify.toast('fasfas')).to.be.false; | ||
chai_1.expect(identify_1.identify.toast(5)).to.be.false; | ||
chai_1.expect(identify_1.identify.toast(null)).to.be.false; | ||
chai_1.expect(Identify_1.identify.toast({})).to.be.false; | ||
chai_1.expect(Identify_1.identify.toast('fasfas')).to.be.false; | ||
chai_1.expect(Identify_1.identify.toast(5)).to.be.false; | ||
chai_1.expect(Identify_1.identify.toast(null)).to.be.false; | ||
}); | ||
}); | ||
}); |
@@ -1,2 +0,1 @@ | ||
export * from './types'; | ||
export * from './utils'; |
@@ -13,3 +13,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./utils"), exports); |
@@ -1,6 +0,8 @@ | ||
import { PlainObject } from './types'; | ||
import { PlainObject } from '../internalTypes'; | ||
export declare function excludeKeys(keys1: string[], keys2: string | string[]): string[]; | ||
export declare function exists(v: unknown): boolean; | ||
export declare function hasAllKeys(keys: string | string[], value: PlainObject): boolean; | ||
export declare function hasInAllKeys(keys: string | string[], value: PlainObject): boolean; | ||
export declare function hasKey(key: string, value: any): boolean; | ||
export declare function hasKeyEqualTo(key: string, value: any): boolean; | ||
export declare function hasAllKeys(keys: string | string[]): (value: PlainObject) => boolean; | ||
export declare function hasInAllKeys(keys: string | string[]): (value: PlainObject) => boolean; | ||
export declare function hasMinimumKeys(keys: string | string[], min: number, value: PlainObject): boolean; | ||
@@ -12,1 +14,8 @@ export declare function hasAnyKeys(keys: string | string[], value: PlainObject): boolean; | ||
export declare function isPlainObject(value: unknown): value is PlainObject; | ||
export declare function isImg(s: string): boolean; | ||
export declare function isPdf(s: string): boolean; | ||
export declare function isVid(s: string): boolean; | ||
export declare function isYml(s?: string): boolean; | ||
export declare function isJson(s?: string): boolean; | ||
export declare function isJs(s?: string): boolean; | ||
export declare function isHtml(s?: string): boolean; |
@@ -6,3 +6,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isPlainObject = exports.isNil = exports.isBool = exports.hasInAnyKeys = exports.hasAnyKeys = exports.hasMinimumKeys = exports.hasInAllKeys = exports.hasAllKeys = exports.exists = exports.excludeKeys = void 0; | ||
exports.isHtml = exports.isJs = exports.isJson = exports.isYml = exports.isVid = exports.isPdf = exports.isImg = exports.isPlainObject = exports.isNil = exports.isBool = exports.hasInAnyKeys = exports.hasAnyKeys = exports.hasMinimumKeys = exports.hasInAllKeys = exports.hasAllKeys = exports.hasKeyEqualTo = exports.hasKey = exports.exists = exports.excludeKeys = void 0; | ||
var get_1 = __importDefault(require("lodash/get")); | ||
var has_1 = __importDefault(require("lodash/has")); | ||
@@ -18,8 +19,20 @@ function excludeKeys(keys1, keys2) { | ||
exports.exists = exists; | ||
function hasAllKeys(keys, value) { | ||
return (Array.isArray(keys) ? keys : [keys]).every(function (k) { return k in value; }); | ||
function hasKey(key, value) { | ||
return has_1.default(value, key); | ||
} | ||
exports.hasKey = hasKey; | ||
function hasKeyEqualTo(key, value) { | ||
return has_1.default(value, key) && get_1.default(value, key) === value; | ||
} | ||
exports.hasKeyEqualTo = hasKeyEqualTo; | ||
function hasAllKeys(keys) { | ||
return function (value) { | ||
return (Array.isArray(keys) ? keys : [keys]).every(function (k) { return k in (value || {}); }); | ||
}; | ||
} | ||
exports.hasAllKeys = hasAllKeys; | ||
function hasInAllKeys(keys, value) { | ||
return (Array.isArray(keys) ? keys : [keys]).every(function (k) { return has_1.default(value, k); }); | ||
function hasInAllKeys(keys) { | ||
return function (value) { | ||
return (Array.isArray(keys) ? keys : [keys]).every(function (k) { return has_1.default(value, k); }); | ||
}; | ||
} | ||
@@ -64,1 +77,33 @@ exports.hasInAllKeys = hasInAllKeys; | ||
exports.isPlainObject = isPlainObject; | ||
function isImg(s) { | ||
return /([a-z\-_0-9\/\:\.]*\.(jpg|jpeg|png|gif))/i.test(s); | ||
} | ||
exports.isImg = isImg; | ||
function isPdf(s) { | ||
return s.endsWith('.pdf'); | ||
} | ||
exports.isPdf = isPdf; | ||
function isVid(s) { | ||
return /([a-z\-_0-9\/\:\.]*\.(mp4|avi|wmv))/i.test(s); | ||
} | ||
exports.isVid = isVid; | ||
function isYml(s) { | ||
if (s === void 0) { s = ''; } | ||
return s.endsWith('.yml'); | ||
} | ||
exports.isYml = isYml; | ||
function isJson(s) { | ||
if (s === void 0) { s = ''; } | ||
return s.endsWith('.json'); | ||
} | ||
exports.isJson = isJson; | ||
function isJs(s) { | ||
if (s === void 0) { s = ''; } | ||
return s.endsWith('.js'); | ||
} | ||
exports.isJs = isJs; | ||
function isHtml(s) { | ||
if (s === void 0) { s = ''; } | ||
return s.endsWith('.html'); | ||
} | ||
exports.isHtml = isHtml; |
@@ -7,2 +7,2 @@ export * from './actionTypes'; | ||
export * from './uncategorizedTypes'; | ||
export { identify } from './identify'; | ||
export { identify } from './Identify'; |
@@ -20,3 +20,3 @@ "use strict"; | ||
__exportStar(require("./uncategorizedTypes"), exports); | ||
var identify_1 = require("./identify"); | ||
Object.defineProperty(exports, "identify", { enumerable: true, get: function () { return identify_1.identify; } }); | ||
var Identify_1 = require("./Identify"); | ||
Object.defineProperty(exports, "identify", { enumerable: true, get: function () { return Identify_1.identify; } }); |
{ | ||
"name": "noodl-types", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"description": "NOODL TypeScript Definitions", | ||
@@ -12,3 +12,2 @@ "author": "Christopher Tran <christopher@aitmed.com>", | ||
"build": "rm -rf dist && tsc", | ||
"build:utils": "rm -rf dist && tsc -p tsconfig-utils.json", | ||
"start": "rm -rf dist && tsc --watch", | ||
@@ -27,3 +26,3 @@ "test": "cross-env TS_NODE_PROJECT=\"tsconfig.test.json\" NODE_ENV=test ts-mocha -r ts-node/register --extensions ts --watch --watch-files src \"src/**/*.test.ts\"" | ||
}, | ||
"gitHead": "8df4f47e6af7384e2703a18180bebe37528c1882" | ||
"gitHead": "a6bf3c5195753e22d150f640dea6e230fe6466cd" | ||
} |
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
29981
798