16.1.3 • Published 3 days ago

@guardian/libs v16.1.3

Weekly downloads
229
License
-
Repository
-
Last release
3 days ago

@guardian/libs

npm (scoped) ES version npm type definitions Coverage Status

A collection of JavaScript libraries and TypeScript types for Guardian projects

ArticleElementRole

Type that describes the role of an element in an article.

Cookies

API over document.cookies.

Core Web Vitals

API over Google’s web-vitals.

Countries

Country data and methods to access it.

Format

Codified editorial design and information architecture.

Locale

Get the user’s current location.

Switches

Get the active switches on theguardian.com.

isBoolean

Check whether a value is a boolean.

isObject

Checks whether a value is a plain object (i.e. {}-like).

isString

Check whether a value is a string.

isUndefined

Check whether a value is undefined.

joinUrl

Combines separate url parts into one valid url string.

loadScript

Inject an external JavaScript file.

log, debug

Selectively log team-specific messages to the console.

Ophan

Types relating to Ophan.

storage

Robust API over localStorage and sessionStorage.

timeAgo

Format absolute dates as time-ago strings.

Installation

Generic badge

yarn add @guardian/libs

or

npm install @guardian/libs

then

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

TypeScript

If you are using this library with TypeScript, make sure you are using at least TypeScript v4.2.2.

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).

16.1.3

3 days ago

16.1.2

9 days ago

16.1.1

16 days ago

16.1.0

1 month ago

16.0.2

3 months ago

16.0.1

4 months ago

16.0.0

5 months ago

15.3.0

10 months ago

15.7.0

9 months ago

15.7.1

9 months ago

15.4.0

10 months ago

15.8.0

8 months ago

15.5.0

9 months ago

15.9.0

7 months ago

15.9.1

7 months ago

15.2.0

10 months ago

15.6.1

9 months ago

15.6.0

9 months ago

15.6.3

9 months ago

15.6.2

9 months ago

15.6.4

9 months ago

15.1.0

11 months ago

14.1.0

11 months ago

15.0.0

11 months ago

13.1.0

1 year ago

12.0.1

1 year ago

14.0.0

1 year ago

13.0.0

1 year ago

10.0.0

1 year ago

12.0.0

1 year ago

11.2.0

1 year ago

11.0.0

1 year ago

10.1.0

1 year ago

10.1.1

1 year ago

11.1.3

1 year ago

11.1.1

1 year ago

11.1.2

1 year ago

11.1.0

1 year ago

9.1.0

2 years ago

9.0.1

2 years ago

9.0.0

2 years ago

8.0.5

2 years ago

8.0.4

2 years ago

7.1.3

2 years ago

7.1.2

2 years ago

7.1.4

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago

8.0.3

2 years ago

8.0.2

2 years ago

6.1.0

2 years ago

7.1.1

2 years ago

7.1.0

2 years ago

5.2.0

2 years ago

6.0.0

2 years ago

6.2.0

2 years ago

7.0.0

2 years ago

5.1.0

2 years ago

4.1.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

5.0.0

2 years ago

3.9.0

2 years ago

3.8.1

2 years ago

3.8.0

2 years ago

3.7.1

2 years ago

3.6.1

2 years ago

3.6.0

2 years ago

3.5.1

3 years ago

3.4.0

3 years ago

3.5.0

3 years ago

3.4.1

3 years ago

3.3.0

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

2.7.0

3 years ago

2.6.0

3 years ago

2.8.0

3 years ago

3.0.0

3 years ago

2.5.0

3 years ago

2.4.0

3 years ago

2.3.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

1.8.1

3 years ago

1.8.0

3 years ago

2.0.0

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.2.0

4 years ago

1.3.0

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago