Socket
Socket
Sign inDemoInstall

@justeat/f-services

Package Overview
Dependencies
11
Maintainers
29
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @justeat/f-services

Fozzie Services - Shared Services for Components and projects


Version published
Maintainers
29
Install size
752 kB
Created

Readme

Source

f-services

Fozzie Bear

npm version CircleCI Coverage Status Known Vulnerabilities

Usage

Installation

Install the module using NPM or Yarn:

yarn add @justeat/f-services
npm install @justeat/f-services

Import the package

You can import it in your component/application like this (please note that styles have to be imported separately)

import { windowServices } from '@justeat/f-services';

// You can then (optionally) destructure
const { addEvent, getWindowWidth, removeEvent } = windowServices;

If you are using Webpack, you can import the component dynamically to separate the services bundle from the main bundle.client.js:

Services in the bundle:


Axios
createClient

Create an axios client.

createCamelCaseClient

Create an axios client with all response JSON transformed to camelCase.

getNetworkDetails

Uses the navigator API (falling back to moz/webkit) to return network information.

objectToCamelCase

Recursively converts object's property names to camelCase.


Globalisation
getLocale

Returns the locale for the current tenant, if the configuration for that locale is present, otherwise returns the default locale.

getTheme

Returns the theme based on the user's locale. Either ml for Menulog or je for Just Eat.


Window

Uses the window-or-global module for SSR compatibility.

addEvent

Add an event listener with a callback function. Optional throttling. Returns the function that will be called by the listener.

getWindowHeight

Returns the current innerHeight.

getWindowWidth

Returns the current innerWidth.

removeEvent

Remove an event listener. To remove a throttled event, pass in the value returned by addEvent when the listener was added.


Utilities
default export

Returns a deep object by traversing following the provided path.


Validations
getFormValidationState

Returns an object containing arrays of the names of valid and invalid validation rules.

isValidPostcode

Returns a boolean indicating whether the provided postcode is valid in the provided locale.

isValidPhoneNumber

Returns a boolean indicating whether the provided phone number is valid in the provided locale.x

Keywords

FAQs

Last updated on 29 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc