1.0.0-alpha.13 • Published 7 days ago

@arcjet/duration v1.0.0-alpha.13

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 days ago

@arcjet/duration

Arcjet utilities for parsing duration strings.

Installation

npm install -S @arcjet/duration

Example

import { parse } from "@arcjet/duration";

const seconds = parse("1h");
console.log(seconds); // prints 3600

Implementation

The implementation of this library is based on the ParseDuration function in the Go stdlib. Originally licensed BSD-3.0 with the license included in our source code.

We've chosen the approach of porting this to TypeScript because our protocol operates exclusively on unsigned 32-bit integers representing seconds. However, we don't want to require our SDK users to manually calculate seconds. By providing this utility, our SDK can accept duration strings and numbers while normalizing the values for our protocol.

License

Licensed under the Apache License, Version 2.0.

1.0.0-alpha.13

7 days ago

1.0.0-alpha.12

1 month ago

1.0.0-alpha.11

2 months ago

1.0.0-alpha.10

2 months ago

1.0.0-alpha.9

3 months ago

1.0.0-alpha.8

4 months ago