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.55 to 1.0.56

22

dist/__tests__/identify.test.js

@@ -6,8 +6,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const chalk_1 = __importDefault(require("chalk"));
const chai_1 = require("chai");
const Identify_1 = require("../Identify");
describe(chalk_1.default.keyword('orange')('Identify'), () => {
describe(`actionChain`, () => {
it(`should accept emit objects`, () => {
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([

@@ -17,3 +17,3 @@ { emit: { dataKey: { var1: 'itemObject' } }, actions: [] },

});
xit(`should accept goto objects`, () => {
xit("should accept goto objects", function () {
chai_1.expect(Identify_1.Identify.actionChain([

@@ -25,3 +25,3 @@ { emit: { dataKey: { var1: 'itemObject' } }, actions: [] },

});
xit(`should accept emit, goto, and toast objects`, () => {
xit("should accept emit, goto, and toast objects", function () {
chai_1.expect(Identify_1.Identify.actionChain([

@@ -34,8 +34,8 @@ { emit: { dataKey: { var1: 'itemObject' } }, actions: [] },

});
describe(`toast`, () => {
it(`should be a toast`, () => {
describe("toast", function () {
it("should be a toast", function () {
chai_1.expect(Identify_1.Identify.toast({ toast: { message: 'hello', style: {} } })).to.be
.true;
});
it(`should not be a toast`, () => {
it("should not be a toast", function () {
chai_1.expect(Identify_1.Identify.toast({ toasft: { message: 'hello', style: {} } })).to.be

@@ -42,0 +42,0 @@ .false;

@@ -7,7 +7,7 @@ "use strict";

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;
const get_1 = __importDefault(require("lodash/get"));
const has_1 = __importDefault(require("lodash/has"));
var get_1 = __importDefault(require("lodash/get"));
var has_1 = __importDefault(require("lodash/has"));
function excludeKeys(keys1, keys2) {
const targetKeys = Array.isArray(keys2) ? keys2 : [keys2];
return keys1.filter((k) => !targetKeys.includes(k));
var targetKeys = Array.isArray(keys2) ? keys2 : [keys2];
return keys1.filter(function (k) { return !targetKeys.includes(k); });
}

@@ -28,16 +28,20 @@ exports.excludeKeys = excludeKeys;

function hasAllKeys(keys) {
return (value) => (Array.isArray(keys) ? keys : [keys]).every((k) => k in (value || {}));
return function (value) {
return (Array.isArray(keys) ? keys : [keys]).every(function (k) { return k in (value || {}); });
};
}
exports.hasAllKeys = hasAllKeys;
function hasInAllKeys(keys) {
return (value) => (Array.isArray(keys) ? keys : [keys]).every((k) => has_1.default(value, k));
return function (value) {
return (Array.isArray(keys) ? keys : [keys]).every(function (k) { return has_1.default(value, k); });
};
}
exports.hasInAllKeys = hasInAllKeys;
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];
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];
if (key in value && !occurrences.includes(key)) {

@@ -54,7 +58,7 @@ count++;

function hasAnyKeys(keys, value) {
return (Array.isArray(keys) ? keys : [keys]).some((k) => k in value);
return (Array.isArray(keys) ? keys : [keys]).some(function (k) { return k in value; });
}
exports.hasAnyKeys = hasAnyKeys;
function hasInAnyKeys(keys, value) {
return (Array.isArray(keys) ? keys : [keys]).some((k) => has_1.default(value, k));
return (Array.isArray(keys) ? keys : [keys]).some(function (k) { return has_1.default(value, k); });
}

@@ -90,15 +94,19 @@ exports.hasInAnyKeys = hasInAnyKeys;

exports.isVid = isVid;
function isYml(s = '') {
function isYml(s) {
if (s === void 0) { s = ''; }
return s.endsWith('.yml');
}
exports.isYml = isYml;
function isJson(s = '') {
function isJson(s) {
if (s === void 0) { s = ''; }
return s.endsWith('.json');
}
exports.isJson = isJson;
function isJs(s = '') {
function isJs(s) {
if (s === void 0) { s = ''; }
return s.endsWith('.js');
}
exports.isJs = isJs;
function isHtml(s = '') {
function isHtml(s) {
if (s === void 0) { s = ''; }
return s.endsWith('.html');

@@ -112,3 +120,3 @@ }

exports.Regex = (function () {
const o = {
var o = {
reference: {

@@ -115,0 +123,0 @@ dot: {

"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) {

@@ -23,39 +34,47 @@ if (k2 === undefined) k2 = k;

exports.Identify = void 0;
const constants_1 = require("./_internal/constants");
const u = __importStar(require("./_internal"));
var constants_1 = require("./_internal/constants");
var u = __importStar(require("./_internal"));
exports.Identify = (function () {
const composeSomes = (...fns) => (arg) => fns.some((fn) => fn(arg));
const o = {
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 = {
action: {
any(v) {
any: function (v) {
return u.isObj(v) && 'actionType' in v;
},
builtIn(v) {
builtIn: function (v) {
return u.isObj(v) && ('funcName' in v || v.actionType === 'builtIn');
},
evalObject(v) {
evalObject: function (v) {
return u.isObj(v) && v.actionType === 'evalObject';
},
pageJump(v) {
pageJump: function (v) {
return u.isObj(v) && v.actionType === 'pageJump';
},
popUp(v) {
popUp: function (v) {
return u.isObj(v) && v.actionType === 'popUp';
},
popUpDismiss(v) {
popUpDismiss: function (v) {
return u.isObj(v) && v.actionType === 'popUpDismiss';
},
refresh(v) {
refresh: function (v) {
return u.isObj(v) && v.actionType === 'refresh';
},
saveObject(v) {
saveObject: function (v) {
return u.isObj(v) && v.actionType === 'saveObject';
},
updateObject(v) {
updateObject: function (v) {
return u.isObj(v) && v.actionType === 'updateObject';
},
},
actionChain(v) {
actionChain: function (v) {
return (Array.isArray(v) &&
[o.action.any, o.emit, o.goto, o.toast].some((fn) => v.some(fn)));
[o.action.any, o.emit, o.goto, o.toast].some(function (fn) { return v.some(fn); }));
},

@@ -67,89 +86,89 @@ /**

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

@@ -167,6 +186,6 @@ return false;

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

@@ -178,3 +197,3 @@ return 'br' in v;

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

@@ -185,6 +204,6 @@ !v.startsWith('.') &&

style: {
any(v) {
any: function (v) {
return u.isObj(v) && u.hasAnyKeys(constants_1.minimalStyleKeys, v);
},
border(v) {
border: function (v) {
return (u.isObj(v) &&

@@ -195,43 +214,46 @@ u.hasAnyKeys(['color', 'style', 'width'], v) &&

},
toast(value) {
toast: function (value) {
return u.isObj(value) && 'message' in value;
},
};
const folds = {
actionChain(v) {
var folds = {
actionChain: function (v) {
return u.isArr(v) && v.some(composeSomes(o.action.any, o.emit, o.goto));
},
component: Object.assign({
any(v) {
any: function (v) {
return (u.isObj(v) &&
'type' in v &&
constants_1.componentTypes.some((t) => v.type === t));
constants_1.componentTypes.some(function (t) { return v.type === t; }));
},
}, Object.assign({}, constants_1.componentTypes.reduce((acc, type) => Object.assign(acc, {
[type](v) {
return u.isObj(v) && v['type'] === type;
},
}), {}))),
emit(value) {
}, 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) {
return u.isObj(value) && 'emit' in value;
},
goto(value) {
goto: function (value) {
return u.isObj(value) && 'goto' in value;
},
path(value) {
path: function (value) {
return u.isObj(value) && 'path' in value;
},
style: {
any() { },
border() { },
any: function () { },
border: function () { },
},
textFunc(value) {
textFunc: function (value) {
return u.isObj(value) && 'text=func' in value;
},
toast(value) {
toast: function (value) {
return u.isObj(value) && 'toast' in value;
},
};
return Object.assign(Object.assign({}, o), { folds });
return __assign(__assign({}, o), { folds: folds });
})();
//# sourceMappingURL=identify.js.map
{
"name": "noodl-types",
"version": "1.0.55",
"version": "1.0.56",
"description": "NOODL TypeScript Definitions",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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