Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

itty-time

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

itty-time - npm Package Compare versions

Comparing version 1.0.0-next.4 to 1.0.0-next.5

2

duration.js

@@ -1,2 +0,2 @@

"use strict";const e=36e5,s=24*e,t={year:315576e5,month:30*s,week:7*s,day:s,hour:e,minute:6e4,second:1e3};exports.duration=(e,{parts:s,join:o=", "}={},n=[])=>{for(const[s,o]of Object.entries(t)){let t=e/o|0;t&&(e-=t*o,"second"==s&&(t+=e/1e3),n.push([t>1?s+"s":s,t]))}return o?n.slice(0,s).map((([e,s])=>s+" "+e)).join(o):n.slice(0,s)};
"use strict";const e=36e5,t=24*e,o={year:315576e5,month:30*t,week:7*t,day:t,hour:e,minute:6e4,second:1e3};exports.duration=(e,{parts:t=9,join:n=", "}={})=>{let r,s=[];for(let[i,u]of Object.entries(o))e>u&&t&&(e-=(r=e/u|0)*u,"second"==i&&(r+=e/1e3),r>1&&(i+="s"),s.push(n?r+" "+i:[i,r]),t--);return n?s.join(n):s};
//# sourceMappingURL=duration.js.map

@@ -1,2 +0,2 @@

"use strict";const e=36e5,t=24*e,s={year:315576e5,month:30*t,week:7*t,day:t,hour:e,minute:6e4,second:1e3},n=e=>{if(+e)return+e;const[,t,n]=e.match(/^([^ ]+) *(\w\w*?)s?$/)||[];return+t*(s[n]||1)};exports.datePlus=(e,t=new Date)=>new Date(t.getTime()+n(e)),exports.duration=(e,{parts:t,join:n=", "}={},o=[])=>{for(const[t,n]of Object.entries(s)){let s=e/n|0;s&&(e-=s*n,"second"==t&&(s+=e/1e3),o.push([s>1?t+"s":t,s]))}return n?o.slice(0,t).map((([e,t])=>t+" "+e)).join(n):o.slice(0,t)},exports.ms=n,exports.seconds=e=>n(e)/1e3;
"use strict";const e=36e5,t=24*e,s={year:315576e5,month:30*t,week:7*t,day:t,hour:e,minute:6e4,second:1e3},r=e=>{if(+e)return+e;const[,t,r]=e.match(/^([^ ]+) *(\w\w*?)s?$/)||[];return+t*(s[r]||1)};exports.datePlus=(e,t=new Date)=>new Date(t.getTime()+r(e)),exports.duration=(e,{parts:t=9,join:r=", "}={})=>{let n,o=[];for(let[u,a]of Object.entries(s))e>a&&t&&(e-=(n=e/a|0)*a,"second"==u&&(n+=e/1e3),n>1&&(u+="s"),o.push(r?n+" "+u:[u,n]),t--);return r?o.join(r):o},exports.ms=r,exports.seconds=e=>r(e)/1e3;
//# sourceMappingURL=index.js.map

@@ -1,3 +0,1 @@

type Ms = (duration: string | number) => number;
export declare const ms: Ms;
export {};
export declare const ms: (duration: string | number) => number;
{
"name": "itty-time",
"version": "1.0.0-next.4",
"version": "1.0.0-next.5",
"description": "Ultra-small (~400 bytes) library for TTL date math and converting ms durations to and from strings.",

@@ -5,0 +5,0 @@ "main": "./index.js",

@@ -1,3 +0,1 @@

type SecondsType = (duration: string | number) => number;
export declare const seconds: SecondsType;
export {};
export declare const seconds: (duration: string | number) => number;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc