@entur/utils
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -6,2 +6,6 @@ # Change Log | ||
## [0.4.3](https://bitbucket.org/enturas/design-system/compare/@entur/utils@0.4.2...@entur/utils@0.4.3) (2022-02-09) | ||
**Note:** Version bump only for package @entur/utils | ||
## [0.4.2](https://bitbucket.org/enturas/design-system/compare/@entur/utils@0.4.1...@entur/utils@0.4.2) (2021-06-25) | ||
@@ -8,0 +12,0 @@ |
@@ -5,7 +5,10 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var React = require('react'); | ||
var warning = require('tiny-warning'); | ||
var React = _interopDefault(require('react')); | ||
var warning = _interopDefault(require('tiny-warning')); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
var warning__default = /*#__PURE__*/_interopDefaultLegacy(warning); | ||
function debounce(fn, delay) { | ||
@@ -26,3 +29,3 @@ var id; | ||
var useRandomId = function useRandomId(prefix) { | ||
var ref = React.useRef(String(Math.random()).substring(2)); | ||
var ref = React__default["default"].useRef(String(Math.random()).substring(2)); | ||
return prefix + "-" + ref.current; | ||
@@ -32,4 +35,4 @@ }; | ||
function useOnMount(callback) { | ||
var hasRun = React.useRef(false); | ||
React.useEffect(function () { | ||
var hasRun = React__default["default"].useRef(false); | ||
React__default["default"].useEffect(function () { | ||
if (!hasRun.current) { | ||
@@ -51,3 +54,3 @@ hasRun.current = true; | ||
var singleMissingImport = missingImports.length === 1; | ||
warning(missingImports.length === 0, "You are missing " + (singleMissingImport ? 'a CSS import' : missingImports.length + " CSS imports") + "!\n\nPlease add the following CSS import" + (singleMissingImport ? '' : 's') + " somewhere in your app:\n\n" + missingImports.map(function (namespace) { | ||
warning__default["default"](missingImports.length === 0, "You are missing " + (singleMissingImport ? 'a CSS import' : missingImports.length + " CSS imports") + "!\n\nPlease add the following CSS import" + (singleMissingImport ? '' : 's') + " somewhere in your app:\n\n" + missingImports.map(function (namespace) { | ||
return "\t@import '~@entur/" + namespace + "/dist/styles.css';"; | ||
@@ -61,3 +64,3 @@ }).join('\n') + "\n") ; | ||
// We skip this check in production, and when we build static sites | ||
if ( typeof window === 'undefined') { | ||
if (typeof window === 'undefined') { | ||
return; | ||
@@ -64,0 +67,0 @@ } // First, let's clear earlier calls to setTimeout |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;require("tiny-warning"),exports.debounce=function(e,t){var r;return function(){for(var n=arguments.length,u=new Array(n),o=0;o<n;o++)u[o]=arguments[o];clearTimeout(r),r=setTimeout((function(){return e.apply(void 0,u)}),t)}},exports.useOnMount=function(e){var r=t.useRef(!1);t.useEffect((function(){r.current||(r.current=!0,e())}),[e])},exports.useRandomId=function(e){return e+"-"+t.useRef(String(Math.random()).substring(2)).current},exports.warnAboutMissingStyles=function(){}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("tiny-warning");var r=t(e);exports.debounce=function(e,t){var r;return function(){for(var n=arguments.length,u=new Array(n),o=0;o<n;o++)u[o]=arguments[o];clearTimeout(r),r=setTimeout((function(){return e.apply(void 0,u)}),t)}},exports.useOnMount=function(e){var t=r.default.useRef(!1);r.default.useEffect((function(){t.current||(t.current=!0,e())}),[e])},exports.useRandomId=function(e){return e+"-"+r.default.useRef(String(Math.random()).substring(2)).current},exports.warnAboutMissingStyles=function(){}; | ||
//# sourceMappingURL=utils.cjs.production.min.js.map |
{ | ||
"name": "@entur/utils", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"license": "EUPL-1.2", | ||
@@ -20,6 +20,6 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"start": "tsdx watch --noClean", | ||
"build": "tsdx build && cp src/*.scss dist", | ||
"test": "tsdx test --env=jsdom", | ||
"lint": "tsdx lint" | ||
"start": "dts watch --noClean", | ||
"build": "dts build && cp src/*.scss dist", | ||
"test": "dts test --env=jsdom", | ||
"lint": "dts lint" | ||
}, | ||
@@ -34,3 +34,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "aa188b2dbee3be6b46b1c59ffb94eee715781eea" | ||
"gitHead": "61e643371cfc5653c93160b7c220152e5b2bafeb" | ||
} |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
142
42455
1