🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

parse-xsd-duration

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-xsd-duration

Parse XSD durations to seconds

0.1.0
Source
npm
Version published
Weekly downloads
863
69.88%
Maintainers
1
Weekly downloads
 
Created
Source

parse-xsd-duration Version

Parse XSD durations to seconds

Installation

$ npm install parse-xsd-duration

Note: this package has zero dependencies and is provided in UMD format so you can easily use it in the browser.

Usage

import pxd from 'parse-xsd-duration'

pxd('PT2M10S')
// => 130

pxd('P2Y6M5DT12H35M30S')
// => 79317330

pxd('P1Y2M3DT5H20M30.123S')
// => 37070430.123

API

parse-xsd-duration(xsdDuration: string): number | null

  • Converts an XSD duration string to seconds.
  • If the string is not a valid XSD duration, it will return null.
  • If the input is not a string, it will throw a TypeError.

License

MIT © Mick Dekkers

Keywords

xsd

FAQs

Package last updated on 12 Apr 2017

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