open-index/open-npm huggingface dataset:
npm package: @financial-times/n-utils
Description: a package of custom utils
Author: Zhenyu Lin
Latest version: 0.1.0

# n-utils [![npm version](https://badge.fury.io/js/%40financial-times%2Fn-utils.svg)](https://badge.fury.io/js/%40financial-times%2Fn-utils) [![CircleCI](https://circleci.com/gh/Financial-Times/n-utils.svg?style=shield)](https://circleci.com/gh/Financial-Times/workflows/n-utils) [![Coverage Status](https://coveralls.io/repos/github/Financial-Times/n-utils/badge.svg?branch=master)](https://coveralls.io/github/Financial-Times/n-utils?branch=master) [![Dependencies](https://david-dm.org/Financial-Times/n-utils.svg)](https://david-dm.org/Financial-Times/n-utils) [![Known Vulnerabilities](https://snyk.io/test/github/Financial-Times/n-utils/badge.svg)](https://snyk.io/test/github/Financial-Times/n-utils)

a package of custom utils
npm package: @financial-times/n-worker
Description: Setup of basic next enhancements for non-web dynos e.g. cron-jobs, pollers
Latest version: 3.1.0
Deprecated: Please uninstall this package.

# n-worker
Setup of basic next enhancements for non-web dynos e.g. cron-jobs, pollers

## API

### n-worker#setup(options)
Sets up node enhamcemets
 - `fetch` as a global using [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch)
 - metrics for processes and fetch
 - flags (optional)

 options:
  - `withFlags` default false - waits for the flags client to initialise and start polling
  - `name` optional - will get the app name from package.json if absent
  - `directory` defaults to `process.cwd()` directory in which to look for config code

Returns a Promise.

Usage:
`javascript
worker.setup(options).then(function(){
	//Application init code
})
`

### n-worker#CronJob(options)
Constructor for a new cron job, with metrics etc. added. `options` expects the same as [npm cron](https://www.npmjs.com/package/cron).CronJob

### n-worker#metrics
Reference to the instance of metrics used by the job

### n-worker#flags
Reference to the instance of flags used by the job
npm package: @financial-times/newsletter-signup
Description: newsletter-signup =================
Author: Ifeanyi Isitor
Latest version: 4.11.1

newsletter-signup
=================

Endpoints to sign an email address up to the FT newsletter (and unsubscribe)

```shell
npm i -S @financial-times/newsletter-signup
```

Usage
-----

Import it, and either call `.listen(port)` directly:

```javascript
import newsletterSignup from '@financial-times/newsletter-signup';

newsletterSignup.listen(process.env.PORT || 3000);
```

or `.use()` it in your own app:

```javascript
import newsletterSignup from '@financial-times/newsletter-signup';
import express from 'express';

const app = express();
app.use('/middleware/root', newsletterSignup);
```

Endpoints
---------

### `POST [/middleware/root]/`

Subscribe an email address provided by the POST body parameter `email` to the mailing list.

If a middleware sets `req.newsletterSignupPostNoResponse` to a truthy value, this endpoint will not send a response, but instead set `res.locals.newsletterSignupStatus` to the status string, so a product can render a template if it needs regular form submission instead of AJAX.

### `GET [/middleware/root]/unsubscribe/:user`

Unsubscribe the user id `:user` from the list. By default, this does not send a response, but sets status variables in `res.locals`. Products using this middleware are responsible for rendering a response, by attaching a route to the same path:

```js
app.use('/middleware/root', newsletterSignup);
app.get('/middleware/root/unsubscribe/:user', (req, res) => {
	res.render('unsubscribe');
});
```

#### Status template variables

The variables `success`, `alreadyUnsubscribed` and `failure` are available in `res.locals` and so any templates rendered in this response. They are mutually-exclusive booleans, i.e. exactly one of them will be true.


Environment vars
----------------

The (self-explanatory) environment variables `ANON_EMAIL_SVC_API_KEY` and `ANON_EMAIL_LIST_API_KEY` are required. There's also the optional variables `ANON_EMAIL_SVC_HOST` and `ANON_EMAIL_LIST_HOST` to configure the hostnames to talk to for these services.

---

Originally part of [next-signup](https://github.com/Financial-Times/next-signup).
npm package: @financial-times/o-audio
Description: Financial Times audio player
Latest version: 2.1.5

# o-audio

The FT audio player.

- [Usage](#usage)
	- [Markup](#markup)
	- [JavaScript](#javascript)
	- [Sass](#sass)
- [Migration](#migration)
- [Contact](#contact)
- [Licence](#licence)

## Usage

This is a beta version of oAudio. It will accept an `<audio>` element + attach o-tracking events to it (for occurences of `play`, `pause` etc). For more details on these events please see [Analytics](analytics.md).

The expectation is that oAudio will eventually render it's own player interface, potentially with different skins, to be used on ft.com and the app.

Check out [how to include Origami components in your project](https://origami.ft.com/documentation/components/#including-origami-components-in-your-project) to get started with `o-audio`.

### Markup

```html
<audio controls data-o-component="o-audio">
	<source
		src="https://media.acast.com/ftnewsbriefing/wednesday-november14/media.mp3"
		type="audio/mpeg"
	/>
</audio>
```

### JavaScript

No code will run automatically unless you are using the Build Service.
You must either construct an `o-audio` object or fire the `o.DOMContentLoaded` event, which oAudio listens for.

#### Constructing an o-audio

```js
import oAudio from "@financial-times/o-audio"
oAudio.init()
```

#### Firing an oDomContentLoaded event

```js
import "@financial-times/o-audio"

document.addEventListener("DOMContentLoaded", function () {
	document.dispatchEvent(new CustomEvent("o.DOMContentLoaded"))
})
```

### Sass

Since oAudio renders as a native HTML `<audio>` element only, there are no styles _as yet_.

## Migration

State | Major Version | Last Minor Release | Migration guide |
:---: | :---: | :---: | :---:
✨ active | 2 | N/A | [migrate to v2](MIGRATION.md#migrating-from-v1-to-v2) |
⚠ maintained | 1 | 1.4 | N/A |


## Contact

If you have any questions or comments about this component, or need help using it, please either [raise an issue](https://github.com/Financial-Times/o-audio/issues) or visit [#ft-next-support](https://financialtimes.slack.com/messages/ft-next-support).

***

## Licence

This software is published by the Financial Times under the [MIT licence](http://opensource.org/licenses/MIT).
npm package: @financial-times/o-autoinit
Description: Provides a standard way of firing the 'o.DOMContentLoaded' events if/when the equivalent browser-native events fire, to auto initialise other components that are in use.
Latest version: 3.1.4

# o-autoinit [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](#licence)


Auto initalise Origami components

- [Usage](#usage)
- [JavaScript](#javascript)
- [Migration](#migration)
- [Contact](#contact)
- [Licence](#licence)

This component comprises a standard way of firing the `o.DOMContentLoaded` event when the equivalent browser-native event fire, and will fire the Origami events even if the native ones have already been and gone, making this suitable for bundling with components that are loaded asyncronously.

## Usage

`o-autoinit` is included automatically by the [Origami Build Service](https://www.ft.com/__origami/service/build/v2/). Manual build users may include `o-autoinit` to initialise Origami components but it is not the only option. See the component [initialisation documentation](https://origami.ft.com/documentation/components/initialising/) for more information.

## JavaScript

```javascript
import 'o-autoinit';
```

The `autoinit` component must be imported after all components that bind to the initialisation events. If it is required more than once, subsequent requires will not have any effect, and the initialisation events may be emitted as early as the first require point.

## Migration

State | Major Version | Last Minor Release | Migration guide |
:---: | :---: | :---: | :---:
✨ active | 3 | N/A  | [migrate to v3](MIGRATION.md#migrating-from-v2-to-v3) |
⚠ maintained | 2 | 2.0.7  | [migrate to v2](MIGRATION.md#migrating-from-v1-to-v2) |
╳ deprecated | 1 | 1.5 | N/A |

## Contact

If you have any questions or comments about this component, or need help using it, please either [raise an issue](https://github.com/Financial-Times/o-autoinit/issues), visit [#origami-support](https://financialtimes.slack.com/messages/origami-support/) or email [Origami Support](mailto:origami-support@ft.com).

***

## Licence

This software is published by the Financial Times under the [MIT licence](http://opensource.org/licenses/MIT).
npm package: @financial-times/o-big-number
Description: Typographical styles to highlight a big number.
Latest version: 3.2.3

# o-big-number

Typographical styles to highlight and describe a big number. Positioning of the big number, for example to the left in a style of a pull-quote, is left to the user. This is so o-big-number may be used in different contexts without writing extra CSS to remove existing positioning.

- [Usage](#usage)
- [Markup](#markup)
- [Sass](#sass)
- [Migration](#migration)
- [Licence](#licence)

## Usage

Check out [how to include Origami components in your project](https://origami.ft.com/documentation/components/#including-origami-components-in-your-project) to get started with `o-big-number`.

## Markup

A big number has two parts. The big number itself and copy to describe the big number.

```html
<div class="o-big-number">
	<div class="o-big-number__title">&pound;350m</div>
	<div class="o-big-number__content">Cost of the rights expected to increase by one-third — or about £350m a year — although some anticipate inflation of up to 70%</div>
</div>
```

## Sass

To output CSS for o-big-number make a single call to the primary mixin `oBigNumber`.

```scss
// outputs .o-big-number, o-big-number__title, etc
@include oBigNumber();
```

We recommend you use `oBigNumber` and default `o-big-number` classes, however if you are unable to update your markup use the mixins `oBigNumberTitle` and `oBigNumberContent`:

```scss
.my-big-number-title {
    @include oBigNumberTitle();
}

.my-big-number-content {
    @include oBigNumberContent();
}
```

## Migration

State | Major Version | Last Minor Release | Migration guide |
:---: | :---: | :---: | :---:
✨ active | 3 | N/A | [migrate to v3](MIGRATION.md#migrating-from-v2-to-v3) |
⚠ maintained | 2 | 2.0 | [migrate to v2](MIGRATION.md#migrating-from-v1-to-v2) |
╳ deprecated | 1 | 1.1 | N/A |

## Licence

This software is published by the Financial Times under the [MIT licence](http://opensource.org/licenses/MIT).