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

@guardian/libs

Package Overview
Dependencies
Maintainers
47
Versions
231
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@guardian/libs

A collection of JavaScript libraries for Guardian projects

  • 2.0.0
  • npm
  • Socket score

Version published
Weekly downloads
2.5K
decreased by-40.02%
Maintainers
47
Weekly downloads
 
Created
Source

@guardian/libs

npm (scoped) ES version npm type definitions Coverage Status

A collection of JavaScript libraries for Guardian projects

Table of contents

Libs

The following modules are available:

getLocale

Get the user’s current location.

isString

Check whether a value is a string.

isUndefined

Check whether a value is undefined.

loadScript

Inject an external JavaScript file.

log/debug

Selectively log team-specific messages to the console.

storage

Robust API over localStorage and sessionStorage.

cookies

API over document.cookies.

timeAgo

Turns absolute dates into time ago strings.

Installation

Generic badge

yarn add @guardian/libs

or

npm install @guardian/libs

then

import { loadScript, storage, ...etc } from '@guardian/libs';

or

<script src="https://unpkg.com/@guardian/libs"></script>
<script>
    // window.gu.libs = { loadScript, storage, ...etc }
</script>

Bundling

This package uses ES2020.

If your target environment does not support that, make sure you transpile this package when bundling your application.

Development

Requirements

  1. Node LTS (latest) (nvm or fnm recommended)
  2. Yarn

Releasing

Changes are automatically released to NPM.

The main branch on GitHub is analysed by semantic-release after every push.

If a commit message follows the conventional commit format, semantic-release can determine what Types of changes are included in that commit.

If necessary, it will then automatically release a new, semver-compliant version of the package to NPM.

Pull requests

Try to write PR titles in the conventional commit format, and squash and merge when merging. That way your PR will trigger a release when you merge it (if necessary).

FAQs

Package last updated on 19 May 2021

Did you know?

Socket

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc