Socket
Socket
Sign inDemoInstall

@chakra-ui/shared-utils

Package Overview
Dependencies
Maintainers
3
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chakra-ui/shared-utils - npm Package Compare versions

Comparing version 0.0.0-dev-20220818130906 to 0.0.0-dev-20220818145526

31

dist/index.cjs.js

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

__export(src_exports, {
callAllHandlers: () => callAllHandlers,
cx: () => cx,
isObject: () => isObject
isObject: () => isObject,
runIfFn: () => runIfFn,
warn: () => warn
});
module.exports = __toCommonJS(src_exports);
var cx = (...classNames) => classNames.filter(Boolean).join(" ");
function isDev() {
return process.env.NODE_ENV !== "production";
}
function isObject(value) {

@@ -33,6 +39,27 @@ const type = typeof value;

}
var warn = (options) => {
const { condition, message } = options;
if (condition && isDev()) {
console.warn(message);
}
};
function runIfFn(valueOrFn, ...args) {
return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
}
function callAllHandlers(...fns) {
return function func(event) {
fns.some((fn) => {
fn == null ? void 0 : fn(event);
return event == null ? void 0 : event.defaultPrevented;
});
};
}
var isFunction = (value) => typeof value === "function";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
callAllHandlers,
cx,
isObject
isObject,
runIfFn,
warn
});

@@ -0,4 +1,13 @@

declare type FunctionArguments<T extends Function> = T extends (...args: infer R) => any ? R : never;
declare const cx: (...classNames: any[]) => string;
declare function isObject(value: any): value is Record<string, any>;
declare type MessageOptions = {
condition: boolean;
message: string;
};
declare const warn: (options: MessageOptions) => void;
declare function runIfFn<T, U>(valueOrFn: T | ((...fnArgs: U[]) => T), ...args: U[]): T;
declare function callAllHandlers<T extends (event: any) => void>(...fns: (T | undefined)[]): (event: FunctionArguments<T>[0]) => void;
export { cx, isObject };
export { callAllHandlers, cx, isObject, runIfFn, warn };
// src/index.ts
var cx = (...classNames) => classNames.filter(Boolean).join(" ");
function isDev() {
return process.env.NODE_ENV !== "production";
}
function isObject(value) {

@@ -7,5 +10,26 @@ const type = typeof value;

}
var warn = (options) => {
const { condition, message } = options;
if (condition && isDev()) {
console.warn(message);
}
};
function runIfFn(valueOrFn, ...args) {
return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
}
function callAllHandlers(...fns) {
return function func(event) {
fns.some((fn) => {
fn == null ? void 0 : fn(event);
return event == null ? void 0 : event.defaultPrevented;
});
};
}
var isFunction = (value) => typeof value === "function";
export {
callAllHandlers,
cx,
isObject
isObject,
runIfFn,
warn
};

2

package.json
{
"name": "@chakra-ui/shared-utils",
"version": "0.0.0-dev-20220818130906",
"version": "0.0.0-dev-20220818145526",
"description": "",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc