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

@justeat/fozzie

Package Overview
Dependencies
Maintainers
54
Versions
326
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@justeat/fozzie - npm Package Compare versions

Comparing version 9.0.0-beta.10 to 9.0.0-beta.11

6

dist/js/index.js

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

enumerable: true,
get: function get() {
get: function () {
return _breakpointHelper.getBreakpoints;

@@ -15,3 +15,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _breakpointHelper.getCurrentScreenWidth;

@@ -22,3 +22,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _breakpointHelper.isWithinBreakpoint;

@@ -25,0 +25,0 @@ }

@@ -8,14 +8,2 @@ "use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**

@@ -26,10 +14,10 @@ * @overview Breakpoint handler

*/
var getBreakpoints = function getBreakpoints() {
var output = {}; // Append hidden element to body
const getBreakpoints = () => {
const output = {}; // Append hidden element to body
var screenSizer = document.createElement('div');
const screenSizer = document.createElement('div');
screenSizer.classList.add('c-screen-sizer');
document.body.appendChild(screenSizer); // It should have a 'content' property containing the breakpoints
var breakpoints = window.getComputedStyle(document.querySelector('.c-screen-sizer')).getPropertyValue('content').replace(/["']/g, '').split(','); // Gives a list of breakpoints in the form ['narrow:414px', ...etc]
const breakpoints = window.getComputedStyle(document.querySelector('.c-screen-sizer')).getPropertyValue('content').replace(/["']/g, '').split(','); // Gives a list of breakpoints in the form ['narrow:414px', ...etc]
// When there is no content, at this stage breakpoints should be ['']

@@ -41,9 +29,5 @@

return breakpoints.reduce(function (prev, current) {
return breakpoints.reduce((prev, current) => {
// `current` is of the form 'narrow:414px'
var _current$split = current.split(':'),
_current$split2 = _slicedToArray(_current$split, 2),
breakpointName = _current$split2[0],
breakpointValue = _current$split2[1];
const [breakpointName, breakpointValue] = current.split(':');
prev[breakpointName] = breakpointValue; // <- the initial value is used for the first iteration

@@ -58,7 +42,7 @@ // The object, e.g., { 'narrow': '414px' } is returned to be used as `prev` in the next iteration

var createBreakpointArray = function createBreakpointArray(breakpoints) {
const createBreakpointArray = breakpoints => {
// Order the breakpoints from widest to narrowest,
// takes the form [['narrow', '414px'], [...etc]]
var bps = [];
Object.keys(breakpoints).forEach(function (key) {
const bps = [];
Object.keys(breakpoints).forEach(key => {
bps.unshift([key, breakpoints[key]]);

@@ -71,11 +55,11 @@ });

var getCurrentScreenWidth = function getCurrentScreenWidth() {
var currentWidth = window.innerWidth;
var breakpoints = getBreakpoints();
var bps = createBreakpointArray(breakpoints);
const getCurrentScreenWidth = () => {
const currentWidth = window.innerWidth;
const breakpoints = getBreakpoints();
const bps = createBreakpointArray(breakpoints);
for (var i = 0; i < bps.length; i++) {
for (let i = 0; i < bps.length; i++) {
// Loops through the breakpoints (in descending order)
// returning the first one that is narrower than currentWidth.
var breakpointWidth = parseInt(bps[i][1], 10); // This also strips the 'px' from the string
const breakpointWidth = parseInt(bps[i][1], 10); // This also strips the 'px' from the string

@@ -94,19 +78,15 @@ if (i === bps.length - 1 || currentWidth > breakpointWidth) {

var isWithinBreakpoint = function isWithinBreakpoint(breakpointString) {
var operatorRegex = /[<>=]+/;
var operatorMatch = breakpointString.match(operatorRegex);
var operator = operatorMatch ? operatorMatch[0] : '';
var _breakpointString$spl = breakpointString.split(operatorRegex),
_breakpointString$spl2 = _slicedToArray(_breakpointString$spl, 2),
breakpoint = _breakpointString$spl2[1];
var currentScreenWidth = window.innerWidth;
var breakpoints = getBreakpoints();
var bps = createBreakpointArray(breakpoints); // We loop through the breakpoint array until we get a match.
const isWithinBreakpoint = breakpointString => {
const operatorRegex = /[<>=]+/;
const operatorMatch = breakpointString.match(operatorRegex);
const operator = operatorMatch ? operatorMatch[0] : '';
const [, breakpoint] = breakpointString.split(operatorRegex);
const currentScreenWidth = window.innerWidth;
const breakpoints = getBreakpoints();
const bps = createBreakpointArray(breakpoints); // We loop through the breakpoint array until we get a match.
// If we match we return the px value as an int. If we do not match we return false
var breakpointToPX = function breakpointToPX(breakpointName) {
var match = false;
bps.forEach(function (bp) {
const breakpointToPX = breakpointName => {
let match = false;
bps.forEach(bp => {
if (bp[0] === breakpointName) {

@@ -119,3 +99,3 @@ match = parseInt(bp[1], 10);

var breakpointInPX = breakpointToPX(breakpoint); // If the breakpoint passed in does not match any we;
const breakpointInPX = breakpointToPX(breakpoint); // If the breakpoint passed in does not match any we;

@@ -126,3 +106,3 @@ if (!breakpointInPX) {

var mediaQuery = {
const mediaQuery = {
'<': currentScreenWidth < breakpointInPX,

@@ -134,3 +114,3 @@ '<=': currentScreenWidth <= breakpointInPX,

};
var result = mediaQuery[operator];
const result = mediaQuery[operator];

@@ -137,0 +117,0 @@ if (result == null) {

@@ -5,3 +5,3 @@ {

"description": "UI Web Framework for the Just Eat Global Platform",
"version": "9.0.0-beta.10",
"version": "9.0.0-beta.11",
"main": "dist/js/index.js",

@@ -41,21 +41,23 @@ "files": [

"devDependencies": {
"@babel/cli": "7.15.7",
"@babel/core": "7.15.8",
"@babel/eslint-parser": "7.15.8",
"@babel/preset-env": "7.15.8",
"@justeat/browserslist-config-fozzie": "1.2.0",
"@justeat/eslint-config-fozzie": "4.0.0",
"@babel/cli": "7.18.10",
"@babel/core": "7.18.10",
"@babel/eslint-parser": "7.18.9",
"@babel/preset-env": "7.18.10",
"@justeat/browserslist-config-fozzie": "2.0.0",
"caniuse-lite": "1.0.30001374",
"@justeat/eslint-config-fozzie": "5.1.0",
"@justeat/f-dom": "1.1.0",
"@justeat/f-logger": "0.8.1",
"@justeat/js-test-buddy": "0.4.1",
"@justeat/stylelint-config-fozzie": "2.2.0",
"concurrently": "6.3.0",
"@justeat/stylelint-config-fozzie": "2.3.0",
"concurrently": "7.3.0",
"coveralls": "3.1.1",
"danger": "10.7.0",
"eslint": "7.21.0",
"eslint-plugin-import": "2.25.2",
"fontfaceobserver": "2.1.0",
"danger": "11.1.1",
"eslint": "8.21.0",
"eslint-plugin-import": "2.26.0",
"fontfaceobserver": "2.3.0",
"glob": "8.0.3",
"jest": "27.3.0",
"sass": "1.49.7",
"jest": "28.1.3",
"jest-environment-jsdom": "^28.1.3",
"sass": "1.54.3",
"sass-true": "6.1.0",

@@ -62,0 +64,0 @@ "stylelint": "13.13.1",

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