New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@entur/utils

Package Overview
Dependencies
Maintainers
0
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@entur/utils - npm Package Compare versions

Comparing version 0.12.1 to 0.12.2-beta.0

3

dist/mergeRefs.d.ts

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

/// <reference types="react" />
export declare const mergeRefs: <T extends HTMLElement>(...refs: (import("react").MutableRefObject<T> | import("react").ForwardedRef<T> | ((node: T | null) => void) | undefined)[]) => (node: T) => void;
export declare const mergeRefs: <T extends HTMLElement>(...refs: (React.MutableRefObject<T> | React.ForwardedRef<T> | ((node: T | null) => void) | undefined)[]) => (node: T) => void;

@@ -115,3 +115,3 @@ 'use strict';

var currentRef = ref.current;
currentRef == null ? void 0 : currentRef.addEventListener('keydown', runIfKeyIsEscape);
currentRef == null || currentRef.addEventListener('keydown', runIfKeyIsEscape);
return function () {

@@ -176,5 +176,5 @@ return currentRef == null ? void 0 : currentRef.removeEventListener('keydown', runIfKeyIsEscape);

function warnAboutMissingStyles() {
var _process, _process$env;
var _process;
// We skip this check in production, and when we build static sites
if (typeof window === 'undefined' || typeof process !== 'undefined' && ((_process = process) == null ? void 0 : (_process$env = _process.env) == null ? void 0 : _process$env.TEST) === 'true') {
if (typeof window === 'undefined' || typeof process !== 'undefined' && ((_process = process) == null || (_process = _process.env) == null ? void 0 : _process.TEST) === 'true') {
return;

@@ -196,10 +196,10 @@ }

// with inspiration from https://stackoverflow.com/questions/50428910/get-text-content-from-node-in-react
var getNodeText = function getNodeText(node) {
var _getNodeText = function getNodeText(node) {
var _node$props$children, _node$props;
if (node === null || node === undefined) return '';
if (['string', 'number'].includes(typeof node)) return node.toString();
if (node instanceof Array) return node.map(getNodeText).join('').trim();
if (node instanceof Array) return node.map(_getNodeText).join('').trim();
if (typeof node === 'object')
// @ts-expect-error props does exist for react nodes
return getNodeText((_node$props$children = (_node$props = node.props) == null ? void 0 : _node$props.children) != null ? _node$props$children : '').trim();
return _getNodeText((_node$props$children = (_node$props = node.props) == null ? void 0 : _node$props.children) != null ? _node$props$children : '').trim();
return 'unknown';

@@ -209,3 +209,3 @@ };

exports.ConditionalWrapper = ConditionalWrapper;
exports.getNodeText = getNodeText;
exports.getNodeText = _getNodeText;
exports.mergeRefs = mergeRefs;

@@ -212,0 +212,0 @@ exports.useDebounce = useDebounce;

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react");require("tiny-warning");var e=function(){if("undefined"==typeof window)return{width:void 0,height:void 0};var n=window;return{width:n.innerWidth,height:n.innerHeight}};exports.ConditionalWrapper=function(e){var t=e.children;return e.condition?(0,e.wrapper)(t):n.createElement(n.Fragment,null,t)},exports.getNodeText=function n(e){var t,r;return null==e?"":["string","number"].includes(typeof e)?e.toString():e instanceof Array?e.map(n).join("").trim():"object"==typeof e?n(null!=(t=null==(r=e.props)?void 0:r.children)?t:"").trim():"unknown"},exports.mergeRefs=function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(n){for(var t=0,r=e;t<r.length;t++){var o=r[t];"function"==typeof o?o(n):o&&(o.current=n)}}},exports.useDebounce=function(e,t){var r=n.useRef();return n.useEffect((function(){return function(){r.current&&clearTimeout(r.current)}}),[]),function(){for(var n=arguments.length,o=new Array(n),u=0;u<n;u++)o[u]=arguments[u];r.current&&clearTimeout(r.current),r.current=setTimeout((function(){e.apply(void 0,o)}),t)}},exports.useForceUpdate=function(){var e=n.useState(0)[1];return function(){return e((function(n){return n+1}))}},exports.useOnClickOutside=function(e,t){n.useEffect((function(){var n=function(n){e.some((function(e){return function(n,e){return!(!n||!(n.contains(e.target)||e.composed&&e.composedPath&&e.composedPath().find((function(e){return e!==window&&n.contains(e)}))))}(e.current,n)}))||t()};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),function(){document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}}),[e,t])},exports.useOnEscape=function(e,t){n.useEffect((function(){var n=function(n){"Escape"===n.key&&t()},r=e.current;return null==r||r.addEventListener("keydown",n),function(){return null==r?void 0:r.removeEventListener("keydown",n)}}),[e,t])},exports.useOnMount=function(e){var t=n.useRef(!1);n.useEffect((function(){t.current||(t.current=!0,e())}),[e])},exports.useRandomId=function(e){return e+"-"+n.useRef(String(Math.random()).substring(2)).current},exports.useWindowDimensions=function(){var t=n.useState(e()),r=t[0],o=t[1];return n.useEffect((function(){function n(){o(e())}if("undefined"!=typeof window)return window.addEventListener("resize",n),function(){return window.removeEventListener("resize",n)}}),[]),r},exports.warnAboutMissingStyles=function(){};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react");require("tiny-warning");var e=function(){if("undefined"==typeof window)return{width:void 0,height:void 0};var n=window;return{width:n.innerWidth,height:n.innerHeight}},t=function(n){var e,r;return null==n?"":["string","number"].includes(typeof n)?n.toString():n instanceof Array?n.map(t).join("").trim():"object"==typeof n?t(null!=(e=null==(r=n.props)?void 0:r.children)?e:"").trim():"unknown"};exports.ConditionalWrapper=function(e){var t=e.children;return e.condition?(0,e.wrapper)(t):n.createElement(n.Fragment,null,t)},exports.getNodeText=t,exports.mergeRefs=function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(n){for(var t=0,r=e;t<r.length;t++){var o=r[t];"function"==typeof o?o(n):o&&(o.current=n)}}},exports.useDebounce=function(e,t){var r=n.useRef();return n.useEffect((function(){return function(){r.current&&clearTimeout(r.current)}}),[]),function(){for(var n=arguments.length,o=new Array(n),u=0;u<n;u++)o[u]=arguments[u];r.current&&clearTimeout(r.current),r.current=setTimeout((function(){e.apply(void 0,o)}),t)}},exports.useForceUpdate=function(){var e=n.useState(0)[1];return function(){return e((function(n){return n+1}))}},exports.useOnClickOutside=function(e,t){n.useEffect((function(){var n=function(n){e.some((function(e){return function(n,e){return!(!n||!(n.contains(e.target)||e.composed&&e.composedPath&&e.composedPath().find((function(e){return e!==window&&n.contains(e)}))))}(e.current,n)}))||t()};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),function(){document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}}),[e,t])},exports.useOnEscape=function(e,t){n.useEffect((function(){var n=function(n){"Escape"===n.key&&t()},r=e.current;return null==r||r.addEventListener("keydown",n),function(){return null==r?void 0:r.removeEventListener("keydown",n)}}),[e,t])},exports.useOnMount=function(e){var t=n.useRef(!1);n.useEffect((function(){t.current||(t.current=!0,e())}),[e])},exports.useRandomId=function(e){return e+"-"+n.useRef(String(Math.random()).substring(2)).current},exports.useWindowDimensions=function(){var t=n.useState(e()),r=t[0],o=t[1];return n.useEffect((function(){function n(){o(e())}if("undefined"!=typeof window)return window.addEventListener("resize",n),function(){return window.removeEventListener("resize",n)}}),[]),r},exports.warnAboutMissingStyles=function(){};
//# sourceMappingURL=utils.cjs.production.min.js.map

@@ -111,3 +111,3 @@ import React, { useRef, useEffect, useState } from 'react';

var currentRef = ref.current;
currentRef == null ? void 0 : currentRef.addEventListener('keydown', runIfKeyIsEscape);
currentRef == null || currentRef.addEventListener('keydown', runIfKeyIsEscape);
return function () {

@@ -172,5 +172,5 @@ return currentRef == null ? void 0 : currentRef.removeEventListener('keydown', runIfKeyIsEscape);

function warnAboutMissingStyles() {
var _process, _process$env;
var _process;
// We skip this check in production, and when we build static sites
if (!(process.env.NODE_ENV !== "production") || typeof window === 'undefined' || typeof process !== 'undefined' && ((_process = process) == null ? void 0 : (_process$env = _process.env) == null ? void 0 : _process$env.TEST) === 'true') {
if (!(process.env.NODE_ENV !== "production") || typeof window === 'undefined' || typeof process !== 'undefined' && ((_process = process) == null || (_process = _process.env) == null ? void 0 : _process.TEST) === 'true') {
return;

@@ -192,14 +192,14 @@ }

// with inspiration from https://stackoverflow.com/questions/50428910/get-text-content-from-node-in-react
var getNodeText = function getNodeText(node) {
var _getNodeText = function getNodeText(node) {
var _node$props$children, _node$props;
if (node === null || node === undefined) return '';
if (['string', 'number'].includes(typeof node)) return node.toString();
if (node instanceof Array) return node.map(getNodeText).join('').trim();
if (node instanceof Array) return node.map(_getNodeText).join('').trim();
if (typeof node === 'object')
// @ts-expect-error props does exist for react nodes
return getNodeText((_node$props$children = (_node$props = node.props) == null ? void 0 : _node$props.children) != null ? _node$props$children : '').trim();
return _getNodeText((_node$props$children = (_node$props = node.props) == null ? void 0 : _node$props.children) != null ? _node$props$children : '').trim();
return 'unknown';
};
export { ConditionalWrapper, getNodeText, mergeRefs, useDebounce, useForceUpdate, useOnClickOutside, useOnEscape, useOnMount, useRandomId, useWindowDimensions, warnAboutMissingStyles };
export { ConditionalWrapper, _getNodeText as getNodeText, mergeRefs, useDebounce, useForceUpdate, useOnClickOutside, useOnEscape, useOnMount, useRandomId, useWindowDimensions, warnAboutMissingStyles };
//# sourceMappingURL=utils.esm.js.map
{
"name": "@entur/utils",
"version": "0.12.1",
"version": "0.12.2-beta.0",
"license": "EUPL-1.2",

@@ -31,3 +31,6 @@ "main": "dist/index.js",

},
"gitHead": "214480c52396a9b6f7133bdb21c81986e69c5ec4"
"devDependencies": {
"dts-cli": "2.0.5"
},
"gitHead": "b213fa4fd10a1a07abada3fa987b7ee2ed110ac2"
}

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc