-
-
Notifications
You must be signed in to change notification settings - Fork 804
/
Copy pathrepl.txt
57 lines (42 loc) · 1.31 KB
/
repl.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{{alias}}( str )
Parses a duration string into an object.
A duration string is a string containing a sequence of time units. A time
unit is a nonnegative integer followed by a unit identifier. The following
unit identifiers are supported:
- d: days.
- h: hours.
- m: minutes.
- s: seconds.
- ms: milliseconds.
Duration strings are case insensitive. For example, the string `1M3S10MS` is
equivalent to `1m3s10ms`.
If a duration string does not contain a time unit, the respective property
is set to 0.
An empty string is considered a valid duration string and is parsed as
`0d0h0m0s0ms`.
Parameters
----------
str: string
Duration string.
Returns
-------
out: Object
Duration object.
out.days: integer
Number of days.
out.hours: integer
Number of hours.
out.minutes: integer
Number of minutes.
out.seconds: integer
Number of seconds.
out.milliseconds: integer
Number of milliseconds.
Examples
--------
> var obj = {{alias}}( '1m3s10ms' )
{ 'days': 0, 'hours': 0, 'minutes': 1, 'seconds': 3, 'milliseconds': 10 }
> obj = {{alias}}( '1m3s' )
{ 'days': 0, 'hours': 0, 'minutes': 1, 'seconds': 3, 'milliseconds': 0 }
See Also
--------