Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@entur-partner/common

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@entur-partner/common - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

dist/FeatureToggle.d.ts

31

dist/common.cjs.development.js

@@ -67,7 +67,38 @@ 'use strict';

/**
* Returns true if the provided flag exist in localStorage
* or is set as an environment variable.
*
* @param flag case sensitive flag. If it is an environment variable
* you can drop the REACT_APP_ prefix.
*/
function useFeatureToggle(flag) {
var _window$localStorage, _window$localStorage2;
if (process.env[`REACT_APP_${flag}`] === 'true' || ((_window$localStorage = window.localStorage) === null || _window$localStorage === void 0 ? void 0 : _window$localStorage.getItem(flag)) === 'true' || ((_window$localStorage2 = window.localStorage) === null || _window$localStorage2 === void 0 ? void 0 : _window$localStorage2.getItem(`REACT_APP_${flag}`)) === 'true') {
return true;
}
return false;
}
const FeatureToggle = ({
children,
flag
}) => {
const feature = useFeatureToggle(flag);
if (feature) {
return children;
}
return null;
};
exports.ActionBar = ActionBar;
exports.ActionBarLeft = ActionBarLeft;
exports.ActionBarRight = ActionBarRight;
exports.FeatureToggle = FeatureToggle;
exports.LinkButton = LinkButton;
exports.Stack = Stack;
exports.useFeatureToggle = useFeatureToggle;
//# sourceMappingURL=common.cjs.development.js.map

2

dist/common.cjs.production.min.js

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

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),a=e(t),r=require("@entur/typography"),n=e(require("classnames"));exports.ActionBar=({children:e})=>a.createElement(a.Fragment,null,a.createElement("div",{className:"eps-action-bar-padding"}),a.createElement("div",{className:"eps-action-bar"},e)),exports.ActionBarLeft=({children:e})=>a.createElement("div",{className:"eps-action-bar-left"},e),exports.ActionBarRight=({children:e})=>a.createElement("div",{className:"eps-action-bar-right"},e),exports.LinkButton=({children:e,className:t,...s})=>a.createElement(r.Link,Object.assign({},s,{as:"button",className:n("eps-link-button",t)}),e),exports.Stack=({children:e,space:r})=>{const n=t.Children.toArray(e);return n.length<=1?a.createElement(a.Fragment,null,n):a.createElement("div",{className:"eps-stack"},n.map((e,t)=>a.createElement("div",t===n.length-1?{key:t}:{className:"eps-pb-"+r,key:t},e)))};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),r=e(t),a=require("@entur/typography"),n=e(require("classnames"));function l(e){var t,r;return"true"===process.env[`REACT_APP_${e}`]||"true"===(null===(t=window.localStorage)||void 0===t?void 0:t.getItem(e))||"true"===(null===(r=window.localStorage)||void 0===r?void 0:r.getItem(`REACT_APP_${e}`))}exports.ActionBar=({children:e})=>r.createElement(r.Fragment,null,r.createElement("div",{className:"eps-action-bar-padding"}),r.createElement("div",{className:"eps-action-bar"},e)),exports.ActionBarLeft=({children:e})=>r.createElement("div",{className:"eps-action-bar-left"},e),exports.ActionBarRight=({children:e})=>r.createElement("div",{className:"eps-action-bar-right"},e),exports.FeatureToggle=({children:e,flag:t})=>l(t)?e:null,exports.LinkButton=({children:e,className:t,...l})=>r.createElement(a.Link,Object.assign({},l,{as:"button",className:n("eps-link-button",t)}),e),exports.Stack=({children:e,space:a})=>{const n=t.Children.toArray(e);return n.length<=1?r.createElement(r.Fragment,null,n):r.createElement("div",{className:"eps-stack"},n.map((e,t)=>r.createElement("div",t===n.length-1?{key:t}:{className:"eps-pb-"+a,key:t},e)))},exports.useFeatureToggle=l;
//# sourceMappingURL=common.cjs.production.min.js.map

@@ -60,3 +60,32 @@ import React, { Children } from 'react';

export { ActionBar, ActionBarLeft, ActionBarRight, LinkButton, Stack };
/**
* Returns true if the provided flag exist in localStorage
* or is set as an environment variable.
*
* @param flag case sensitive flag. If it is an environment variable
* you can drop the REACT_APP_ prefix.
*/
function useFeatureToggle(flag) {
var _window$localStorage, _window$localStorage2;
if (process.env[`REACT_APP_${flag}`] === 'true' || ((_window$localStorage = window.localStorage) === null || _window$localStorage === void 0 ? void 0 : _window$localStorage.getItem(flag)) === 'true' || ((_window$localStorage2 = window.localStorage) === null || _window$localStorage2 === void 0 ? void 0 : _window$localStorage2.getItem(`REACT_APP_${flag}`)) === 'true') {
return true;
}
return false;
}
const FeatureToggle = ({
children,
flag
}) => {
const feature = useFeatureToggle(flag);
if (feature) {
return children;
}
return null;
};
export { ActionBar, ActionBarLeft, ActionBarRight, FeatureToggle, LinkButton, Stack, useFeatureToggle };
//# sourceMappingURL=common.esm.js.map

@@ -5,1 +5,2 @@ import './index.scss';

export { LinkButton } from './LinkButton';
export { useFeatureToggle, FeatureToggle } from './FeatureToggle';
{
"name": "@entur-partner/common",
"version": "0.0.2",
"version": "0.0.3",
"license": "EUPL-1.2",

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

},
"gitHead": "01f63a2991739d2303fcdc56efaff4d78da002c9"
"gitHead": "5e8e400a33ff29f23b669d49eba555b0a914dafb"
}

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