noodl-types
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -9,3 +9,4 @@ import { PlainObject } from './types'; | ||
export declare function hasInAnyKeys(keys: string | string[], value: PlainObject): boolean; | ||
export declare function isBool(value: unknown): value is Boolean; | ||
export declare function isNil(v: unknown): boolean; | ||
export declare function isPlainObject(value: unknown): value is PlainObject; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isPlainObject = exports.isNil = exports.hasInAnyKeys = exports.hasAnyKeys = exports.hasMinimumKeys = exports.hasInAllKeys = exports.hasAllKeys = exports.exists = exports.excludeKeys = void 0; | ||
exports.isPlainObject = exports.isNil = exports.isBool = exports.hasInAnyKeys = exports.hasAnyKeys = exports.hasMinimumKeys = exports.hasInAllKeys = exports.hasAllKeys = exports.exists = exports.excludeKeys = void 0; | ||
var has_1 = __importDefault(require("lodash/has")); | ||
@@ -51,2 +51,6 @@ function excludeKeys(keys1, keys2) { | ||
exports.hasInAnyKeys = hasInAnyKeys; | ||
function isBool(value) { | ||
return typeof value === 'boolean'; | ||
} | ||
exports.isBool = isBool; | ||
function isNil(v) { | ||
@@ -53,0 +57,0 @@ return v === null || typeof v === 'undefined'; |
import { ActionObject, BuiltInActionObject, EvalActionObject, PageJumpActionObject, PopupActionObject, PopupDismissActionObject, RefreshActionObject, SaveActionObject, UpdateActionObject } from './actionTypes'; | ||
import { ButtonComponentObject, DividerComponentObject, FooterComponentObject, HeaderComponentObject, ImageComponentObject, LabelComponentObject, ListComponentObject, ListItemComponentObject, PluginBodyTailComponentObject, PluginComponentObject, PluginHeadComponentObject, PopUpComponentObject, RegisterComponentObject, ScrollViewComponentObject, SelectComponentObject, TextFieldComponentObject, TextViewComponentObject, VideoComponentObject, ViewComponentObject } from './componentTypes'; | ||
import { EmitObject, GotoObject } from './uncategorizedTypes'; | ||
import { EmitObject, GotoObject, ToastObject } from './uncategorizedTypes'; | ||
export declare const identify: { | ||
@@ -17,2 +17,10 @@ action: { | ||
actionChain(v: unknown): v is ActionObject<any>[]; | ||
/** | ||
* Returns true if the value is a NOODL boolean. A value is a NOODL boolean | ||
* if the value is truthy, true, "true", false, or "false" | ||
* @param { any } value | ||
*/ | ||
isBoolean(value: unknown): boolean; | ||
isBooleanTrue(value: unknown): value is true | "true"; | ||
isBooleanFalse(value: unknown): value is false | "false"; | ||
component: { | ||
@@ -43,2 +51,3 @@ button(value: unknown): value is ButtonComponentObject; | ||
gotoObject(v: unknown): v is GotoObject; | ||
reference(value: unknown): value is string; | ||
style: { | ||
@@ -48,2 +57,5 @@ any(v: unknown): boolean; | ||
}; | ||
toast(value: unknown): value is { | ||
toast: ToastObject; | ||
}; | ||
}; |
@@ -43,2 +43,16 @@ "use strict"; | ||
}, | ||
/** | ||
* Returns true if the value is a NOODL boolean. A value is a NOODL boolean | ||
* if the value is truthy, true, "true", false, or "false" | ||
* @param { any } value | ||
*/ | ||
isBoolean: function (value) { | ||
return _internal_1.isBool(value) || o.isBooleanTrue(value) || o.isBooleanFalse(value); | ||
}, | ||
isBooleanTrue: function (value) { | ||
return value === true || value === 'true'; | ||
}, | ||
isBooleanFalse: function (value) { | ||
return value === false || value === 'false'; | ||
}, | ||
component: { | ||
@@ -115,2 +129,15 @@ button: function (value) { | ||
}, | ||
reference: function (value) { | ||
if (typeof value !== 'string') | ||
return false; | ||
if (value.startsWith('.')) | ||
return true; | ||
if (value.startsWith('=')) | ||
return true; | ||
if (value.startsWith('@')) | ||
return true; | ||
if (value.endsWith('@')) | ||
return true; | ||
return false; | ||
}, | ||
style: { | ||
@@ -126,4 +153,7 @@ any: function (v) { | ||
}, | ||
toast: function (value) { | ||
return _internal_1.isPlainObject(value) && 'toast' in value; | ||
}, | ||
}; | ||
return o; | ||
})(); |
@@ -0,1 +1,2 @@ | ||
import { StyleObject } from './styleTypes'; | ||
export interface EmitObject { | ||
@@ -20,1 +21,5 @@ emit: { | ||
} | ||
export interface ToastObject { | ||
message?: string; | ||
style?: StyleObject; | ||
} |
{ | ||
"name": "noodl-types", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "NOODL TypeScript Definitions", | ||
@@ -14,3 +14,3 @@ "author": "Christopher Tran <christopher@aitmed.com>", | ||
"start": "rm -rf dist && tsc --watch", | ||
"test": "echo \"Error: run tests from root\" && exit 1" | ||
"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\"" | ||
}, | ||
@@ -27,3 +27,3 @@ "directories": { | ||
}, | ||
"gitHead": "3140509344a00c54eed635a5f1276735db6071ac" | ||
"gitHead": "c5b968cb5e32636e156b5908992c808e2d789ee2" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25469
27
640
0