Socket
Socket
Sign inDemoInstall

noodl-types

Package Overview
Dependencies
0
Maintainers
1
Versions
240
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.51 to 1.0.52

45

dist/__tests__/identify.test.js

@@ -1,18 +0,13 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var chalk_1 = __importDefault(require("chalk"));
var chai_1 = require("chai");
var Identify_1 = require("../Identify");
describe(chalk_1.default.keyword('orange')('Identify'), function () {
describe("actionChain", function () {
it("should accept emit objects", function () {
chai_1.expect(Identify_1.Identify.actionChain([
import chalk from 'chalk';
import { expect } from 'chai';
import { Identify } from '../Identify';
describe(chalk.keyword('orange')('Identify'), () => {
describe(`actionChain`, () => {
it(`should accept emit objects`, () => {
expect(Identify.actionChain([
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] },
])).to.be.true;
});
xit("should accept goto objects", function () {
chai_1.expect(Identify_1.Identify.actionChain([
xit(`should accept goto objects`, () => {
expect(Identify.actionChain([
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] },

@@ -23,4 +18,4 @@ { goto: 'PatientDashboard' },

});
xit("should accept emit, goto, and toast objects", function () {
chai_1.expect(Identify_1.Identify.actionChain([
xit(`should accept emit, goto, and toast objects`, () => {
expect(Identify.actionChain([
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] },

@@ -32,14 +27,14 @@ { goto: 'PatientDashboard' },

});
describe("toast", function () {
it("should be a toast", function () {
chai_1.expect(Identify_1.Identify.toast({ toast: { message: 'hello', style: {} } })).to.be
describe(`toast`, () => {
it(`should be a toast`, () => {
expect(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
it(`should not be a toast`, () => {
expect(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;
expect(Identify.toast({})).to.be.false;
expect(Identify.toast('fasfas')).to.be.false;
expect(Identify.toast(5)).to.be.false;
expect(Identify.toast(null)).to.be.false;
});

@@ -46,0 +41,0 @@ });

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.minimalBorderStyleKeys = exports.minimalStyleKeys = exports.componentTypes = void 0;
exports.componentTypes = [
export const componentTypes = [
'button',

@@ -26,3 +23,3 @@ 'divider',

];
exports.minimalStyleKeys = [
export const minimalStyleKeys = [
'backgroundColor',

@@ -47,3 +44,3 @@ 'border',

];
exports.minimalBorderStyleKeys = ['color', 'style', 'width'];
export const minimalBorderStyleKeys = ['color', 'style', 'width'];
//# sourceMappingURL=constants.js.map

@@ -1,14 +0,2 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./utils"), exports);
export * from './utils';
//# sourceMappingURL=index.js.map

@@ -1,45 +0,29 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Regex = exports.isStr = exports.isHtml = exports.isJs = exports.isJson = exports.isYml = exports.isVid = exports.isPdf = exports.isImg = exports.isObj = exports.isNil = exports.isBool = exports.isArr = 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"));
function excludeKeys(keys1, keys2) {
var targetKeys = Array.isArray(keys2) ? keys2 : [keys2];
return keys1.filter(function (k) { return !targetKeys.includes(k); });
import get from 'lodash/get';
import has from 'lodash/has';
export function excludeKeys(keys1, keys2) {
const targetKeys = Array.isArray(keys2) ? keys2 : [keys2];
return keys1.filter((k) => !targetKeys.includes(k));
}
exports.excludeKeys = excludeKeys;
function exists(v) {
export function exists(v) {
return !isNil(v);
}
exports.exists = exists;
function hasKey(key, value) {
return has_1.default(value, key);
export function hasKey(key, value) {
return has(value, key);
}
exports.hasKey = hasKey;
function hasKeyEqualTo(key, value) {
return has_1.default(value, key) && get_1.default(value, key) === value;
export function hasKeyEqualTo(key, value) {
return has(value, key) && get(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 || {}); });
};
export function hasAllKeys(keys) {
return (value) => (Array.isArray(keys) ? keys : [keys]).every((k) => k in (value || {}));
}
exports.hasAllKeys = hasAllKeys;
function hasInAllKeys(keys) {
return function (value) {
return (Array.isArray(keys) ? keys : [keys]).every(function (k) { return has_1.default(value, k); });
};
export function hasInAllKeys(keys) {
return (value) => (Array.isArray(keys) ? keys : [keys]).every((k) => has(value, k));
}
exports.hasInAllKeys = hasInAllKeys;
function hasMinimumKeys(keys, min, value) {
var occurrences = [];
var keyz = Array.isArray(keys) ? keys : [keys];
var numKeyz = keyz.length;
var count = 0;
for (var index = 0; index < numKeyz; index++) {
var key = keyz[index];
export function hasMinimumKeys(keys, min, value) {
const occurrences = [];
const keyz = Array.isArray(keys) ? keys : [keys];
const numKeyz = keyz.length;
let count = 0;
for (let index = 0; index < numKeyz; index++) {
const key = keyz[index];
if (key in value && !occurrences.includes(key)) {

@@ -54,65 +38,46 @@ count++;

}
exports.hasMinimumKeys = hasMinimumKeys;
function hasAnyKeys(keys, value) {
return (Array.isArray(keys) ? keys : [keys]).some(function (k) { return k in value; });
export function hasAnyKeys(keys, value) {
return (Array.isArray(keys) ? keys : [keys]).some((k) => k in value);
}
exports.hasAnyKeys = hasAnyKeys;
function hasInAnyKeys(keys, value) {
return (Array.isArray(keys) ? keys : [keys]).some(function (k) { return has_1.default(value, k); });
export function hasInAnyKeys(keys, value) {
return (Array.isArray(keys) ? keys : [keys]).some((k) => has(value, k));
}
exports.hasInAnyKeys = hasInAnyKeys;
function isArr(v) {
export function isArr(v) {
return Array.isArray(v);
}
exports.isArr = isArr;
function isBool(value) {
export function isBool(value) {
return typeof value === 'boolean';
}
exports.isBool = isBool;
function isNil(v) {
export function isNil(v) {
return v === null || typeof v === 'undefined';
}
exports.isNil = isNil;
function isObj(value) {
export function isObj(value) {
return exists(value) && !Array.isArray(value) && typeof value === 'object';
}
exports.isObj = isObj;
function isImg(s) {
export function isImg(s) {
return /([a-z\-_0-9\/\:\.]*\.(jpg|jpeg|png|gif))/i.test(s);
}
exports.isImg = isImg;
function isPdf(s) {
export function isPdf(s) {
return s.endsWith('.pdf');
}
exports.isPdf = isPdf;
function isVid(s) {
export 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 = ''; }
export function isYml(s = '') {
return s.endsWith('.yml');
}
exports.isYml = isYml;
function isJson(s) {
if (s === void 0) { s = ''; }
export function isJson(s = '') {
return s.endsWith('.json');
}
exports.isJson = isJson;
function isJs(s) {
if (s === void 0) { s = ''; }
export function isJs(s = '') {
return s.endsWith('.js');
}
exports.isJs = isJs;
function isHtml(s) {
if (s === void 0) { s = ''; }
export function isHtml(s = '') {
return s.endsWith('.html');
}
exports.isHtml = isHtml;
function isStr(v) {
export function isStr(v) {
return typeof v === 'string';
}
exports.isStr = isStr;
exports.Regex = (function () {
var o = {
export const Regex = (function () {
const o = {
reference: {

@@ -119,0 +84,0 @@ dot: {

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=actionTypes.js.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=componentTypes.js.map

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.userEvent = exports.styleKeys = exports.contentTypes = exports.componentTypes = exports.componentKeys = exports.component = exports.actionTypes = exports.action = void 0;
exports.action = {
export const action = {
BUILTIN: 'builtIn',

@@ -15,4 +12,4 @@ EVALOBJECT: 'evalObject',

};
exports.actionTypes = Object.values(exports.action);
exports.component = {
export const actionTypes = Object.values(action);
export const component = {
BUTTON: 'button',

@@ -42,3 +39,3 @@ CHART: 'chart',

};
exports.componentKeys = [
export const componentKeys = [
'backgroundColor',

@@ -79,4 +76,4 @@ 'borderRadius',

];
exports.componentTypes = Object.values(exports.component);
exports.contentTypes = [
export const componentTypes = Object.values(component);
export const contentTypes = [
'countryCode',

@@ -101,3 +98,3 @@ 'email',

];
exports.styleKeys = [
export const styleKeys = [
'FontSize',

@@ -152,3 +149,3 @@ 'axis',

];
exports.userEvent = [
export const userEvent = [
'onBlur',

@@ -155,0 +152,0 @@ 'onClick',

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=constantTypes.js.map

@@ -1,79 +0,38 @@

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Identify = void 0;
var constants_1 = require("./_internal/constants");
var u = __importStar(require("./_internal"));
exports.Identify = (function () {
var composeSomes = function () {
var fns = [];
for (var _i = 0; _i < arguments.length; _i++) {
fns[_i] = arguments[_i];
}
return function (arg) {
return fns.some(function (fn) { return fn(arg); });
};
};
var o = {
import { componentTypes, minimalStyleKeys, minimalBorderStyleKeys, } from './_internal/constants';
import * as u from './_internal';
export const Identify = (function () {
const composeSomes = (...fns) => (arg) => fns.some((fn) => fn(arg));
const o = {
action: {
any: function (v) {
any(v) {
return u.isObj(v) && 'actionType' in v;
},
builtIn: function (v) {
builtIn(v) {
return u.isObj(v) && ('funcName' in v || v.actionType === 'builtIn');
},
evalObject: function (v) {
evalObject(v) {
return u.isObj(v) && v.actionType === 'evalObject';
},
pageJump: function (v) {
pageJump(v) {
return u.isObj(v) && v.actionType === 'pageJump';
},
popUp: function (v) {
popUp(v) {
return u.isObj(v) && v.actionType === 'popUp';
},
popUpDismiss: function (v) {
popUpDismiss(v) {
return u.isObj(v) && v.actionType === 'popUpDismiss';
},
refresh: function (v) {
refresh(v) {
return u.isObj(v) && v.actionType === 'refresh';
},
saveObject: function (v) {
saveObject(v) {
return u.isObj(v) && v.actionType === 'saveObject';
},
updateObject: function (v) {
updateObject(v) {
return u.isObj(v) && v.actionType === 'updateObject';
},
},
actionChain: function (v) {
actionChain(v) {
return (Array.isArray(v) &&
[o.action.any, o.emit, o.goto, o.toast].some(function (fn) { return v.some(fn); }));
[o.action.any, o.emit, o.goto, o.toast].some((fn) => v.some(fn)));
},

@@ -85,89 +44,89 @@ /**

*/
isBoolean: function (value) {
isBoolean(value) {
return o.isBooleanTrue(value) || o.isBooleanFalse(value);
},
isBooleanTrue: function (value) {
isBooleanTrue(value) {
return value === true || value === 'true';
},
isBooleanFalse: function (value) {
isBooleanFalse(value) {
return value === false || value === 'false';
},
component: {
button: function (value) {
button(value) {
return u.isObj(value) && value.type === 'button';
},
divider: function (value) {
divider(value) {
return u.isObj(value) && value.type === 'divider';
},
footer: function (value) {
footer(value) {
return u.isObj(value) && value.type === 'footer';
},
header: function (value) {
header(value) {
return u.isObj(value) && value.type === 'header';
},
image: function (value) {
image(value) {
return u.isObj(value) && value.type === 'image';
},
label: function (value) {
label(value) {
return u.isObj(value) && value.type === 'label';
},
list: function (value) {
list(value) {
return u.isObj(value) && value.type === 'list';
},
listLike: function (value) {
listLike(value) {
return u.isObj(value) && ['chatList', 'list'].includes(value.type);
},
listItem: function (value) {
listItem(value) {
return u.isObj(value) && value.type === 'listItem';
},
map: function (value) {
map(value) {
return u.isObj(value) && value.type === 'map';
},
page: function (value) {
page(value) {
return u.isObj(value) && value.type === 'page';
},
plugin: function (value) {
plugin(value) {
return u.isObj(value) && value.type === 'plugin';
},
pluginHead: function (value) {
pluginHead(value) {
return u.isObj(value) && value.type === 'pluginHead';
},
pluginBodyTail: function (value) {
pluginBodyTail(value) {
return u.isObj(value) && value.type === 'pluginBodyTail';
},
popUp: function (value) {
popUp(value) {
return u.isObj(value) && value.type === 'popUp';
},
register: function (value) {
register(value) {
return u.isObj(value) && value.type === 'register';
},
select: function (value) {
select(value) {
return u.isObj(value) && value.type === 'select';
},
scrollView: function (value) {
scrollView(value) {
return u.isObj(value) && value.type === 'scrollView';
},
textField: function (value) {
textField(value) {
return u.isObj(value) && value.type === 'textField';
},
textView: function (value) {
textView(value) {
return u.isObj(value) && value.type === 'textView';
},
video: function (value) {
video(value) {
return u.isObj(value) && value.type === 'video';
},
view: function (value) {
view(value) {
return u.isObj(value) && value.type === 'view';
},
},
emit: function (v) {
emit(v) {
return u.isObj(v) && 'emit' in v;
},
goto: function (v) {
goto(v) {
return u.isObj(v) && 'goto' in v;
},
if: function (v) {
if(v) {
return u.isObj(v) && 'if' in v;
},
reference: function (value) {
reference(value) {
if (typeof value !== 'string')

@@ -185,6 +144,6 @@ return false;

},
textBoard: function (v) {
return u.isArr(v) && v.some(function (o) { return o.textBoardItem; });
textBoard(v) {
return u.isArr(v) && v.some((o) => o.textBoardItem);
},
textBoardItem: function (v) {
textBoardItem(v) {
if (u.isObj(v))

@@ -196,3 +155,3 @@ return 'br' in v;

},
url: function (v) {
url(v) {
return (typeof v === 'string' &&

@@ -203,55 +162,55 @@ !v.startsWith('.') &&

style: {
any: function (v) {
return u.isObj(v) && u.hasAnyKeys(constants_1.minimalStyleKeys, v);
any(v) {
return u.isObj(v) && u.hasAnyKeys(minimalStyleKeys, v);
},
border: function (v) {
border(v) {
return (u.isObj(v) &&
u.hasAnyKeys(['color', 'style', 'width'], v) &&
!u.hasAnyKeys(u.excludeKeys(constants_1.minimalStyleKeys, constants_1.minimalBorderStyleKeys), v));
!u.hasAnyKeys(u.excludeKeys(minimalStyleKeys, minimalBorderStyleKeys), v));
},
},
toast: function (value) {
toast(value) {
return u.isObj(value) && 'message' in value;
},
};
var folds = {
actionChain: function (v) {
const folds = {
actionChain(v) {
return u.isArr(v) && v.some(composeSomes(o.action.any, o.emit, o.goto));
},
component: Object.assign({
any: function (v) {
any(v) {
return (u.isObj(v) &&
'type' in v &&
constants_1.componentTypes.some(function (t) { return v.type === t; }));
componentTypes.some((t) => v.type === t));
},
}, Object.assign({}, constants_1.componentTypes.reduce(function (acc, type) {
var _a;
return Object.assign(acc, (_a = {},
_a[type] = function (v) {
return u.isObj(v) && v['type'] === type;
},
_a));
}, {}))),
emit: function (value) {
}, Object.assign({}, componentTypes.reduce((acc, type) => Object.assign(acc, {
[type](v) {
return u.isObj(v) && v['type'] === type;
},
}), {}))),
emit(value) {
return u.isObj(value) && 'emit' in value;
},
goto: function (value) {
goto(value) {
return u.isObj(value) && 'goto' in value;
},
path: function (value) {
path(value) {
return u.isObj(value) && 'path' in value;
},
style: {
any: function () { },
border: function () { },
any() { },
border() { },
},
textFunc: function (value) {
textFunc(value) {
return u.isObj(value) && 'text=func' in value;
},
toast: function (value) {
toast(value) {
return u.isObj(value) && 'toast' in value;
},
};
return __assign(__assign({}, o), { folds: folds });
return {
...o,
folds,
};
})();
//# sourceMappingURL=identify.js.map

@@ -1,23 +0,9 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Identify = void 0;
__exportStar(require("./actionTypes"), exports);
__exportStar(require("./componentTypes"), exports);
__exportStar(require("./constantTypes"), exports);
__exportStar(require("./pageTypes"), exports);
__exportStar(require("./styleTypes"), exports);
__exportStar(require("./uncategorizedTypes"), exports);
__exportStar(require("./constants"), exports);
var Identify_1 = require("./Identify");
Object.defineProperty(exports, "Identify", { enumerable: true, get: function () { return Identify_1.Identify; } });
export * from './actionTypes';
export * from './componentTypes';
export * from './constantTypes';
export * from './pageTypes';
export * from './styleTypes';
export * from './uncategorizedTypes';
export * from './constants';
export { Identify } from './Identify';
//# sourceMappingURL=index.js.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=internalTypes.js.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=pageTypes.js.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=styleTypes.js.map

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=uncategorizedTypes.js.map
{
"name": "noodl-types",
"version": "1.0.51",
"version": "1.0.52",
"description": "NOODL TypeScript Definitions",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",

@@ -7,0 +8,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc