UNPKG

1.88 kBMarkdownView Raw
1# server-timify
2
3[![npm version](https://img.shields.io/npm/v/server-timify)](https://npmjs.com/package/server-timify)
4[![npm size](https://img.shields.io/bundlephobia/minzip/server-timify)](https://bundlephobia.com/package/server-timify)
5[![install size](https://packagephobia.com/badge?p=server-timify)](https://packagephobia.com/result?p=server-timify)
6[![code coverage](https://codecov.io/gh/getoslash/server-timify/branch/main/graph/badge.svg?token=VBS5M4qYfz)](https://codecov.io/gh/getoslash/server-timify)
7[![Release](https://github.com/getoslash/server-timify/actions/workflows/release.yml/badge.svg?event=push)](https://github.com/getoslash/server-timify/actions/workflows/release.yml)
8[![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/getoslash/server-timify)
9
10⏱ Parse and stringifying utility methods for the [`Server-Timing`](https://www.smashingmagazine.com/2018/10/performance-server-timing/) header. Very forgiving and does not throw any errors for any invalid input.
11
12## Install
13
14```bash
15npm install server-timify
16# OR
17yarn add server-timify
18```
19
20## Usage
21
22```typescript
23import { parse, stringify } from 'server-timify'
24
25parse('cache;desc="Cache Read";dur=23.2')
26// [{ name: "cache", description: "Cache Read", duration: 23.2 }]
27
28stringify([{ name: "cache", description: "Cache Read", duration: 23.2 }])
29// cache;desc="Cache Read";dur=23.2
30```
31
32Read ["Measuring Performance With Server Timing"](https://www.smashingmagazine.com/2018/10/performance-server-timing/) to learn how to use the `Server-Timing` header.
33
34## License
35
36The code in this project is released under the [MIT License](LICENSE).
37
38[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fgetoslash%2Fserver-timify.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fgetoslash%2Fserver-timify?ref=badge_large)