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

string-kit

Package Overview
Dependencies
Maintainers
1
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-kit - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

1

documentation.md

@@ -75,2 +75,3 @@

* `%k` number with metric system prefixes (like k, M, G, and so on...)
* `%m` degrees/minutes/seconds notation
* `%t` time duration, convert ms into H:min:s

@@ -77,0 +78,0 @@ * `%h` unsigned hexadecimal

@@ -480,2 +480,31 @@ /*

// Degree, minutes and seconds.
// Unlike %t which receive ms, here the input is in degree.
modes.m = arg => {
if ( typeof arg === 'string' ) { arg = parseFloat( arg ) ; }
if ( typeof arg !== 'number' ) { return '(NaN)' ; }
var minus = '' ;
if ( arg < 0 ) { minus = '-' ; arg = -arg ; }
var degrees = epsilonFloor( arg ) ,
frac = arg - degrees ;
if ( ! frac ) { return minus + degrees + '°' ; }
var minutes = epsilonFloor( frac * 60 ) ,
seconds = epsilonFloor( frac * 3600 - minutes * 60 ) ;
if ( seconds ) {
return minus + degrees + '°' + ( '' + minutes ).padStart( 2 , '0' ) + '′' + ( '' + seconds ).padStart( 2 , '0' ) + '″' ;
}
return minus + degrees + '°' + ( '' + minutes ).padStart( 2 , '0' ) + '′' ;
} ;
modes.m.noSanitize = true ;
// time duration, transform ms into H:min:s

@@ -898,2 +927,6 @@ // Later it should format Date as well: number=duration, date object=date

function epsilonFloor( v ) {
return Math.floor( v + EPSILON ) ;
}
// Round with precision

@@ -900,0 +933,0 @@ function round( v , step ) {

2

package.json
{
"name": "string-kit",
"version": "0.11.0",
"version": "0.11.1",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=6.0.0"

@@ -75,2 +75,3 @@

* `%k` number with metric system prefixes (like k, M, G, and so on...)
* `%m` degrees/minutes/seconds notation
* `%t` time duration, convert ms into H:min:s

@@ -77,0 +78,0 @@ * `%h` unsigned hexadecimal

@@ -270,2 +270,12 @@ /*

it( "%m degree minute seconds notation" , () => {
expect( format( '%m' , 0 ) ).to.be( '0°' ) ;
expect( format( '%m' , 10 ) ).to.be( '10°' ) ;
expect( format( '%m' , -10 ) ).to.be( '-10°' ) ;
expect( format( '%m' , 1 + 17 / 60 ) ).to.be( '1°17′' ) ;
expect( format( '%m' , 1 + 1 / 60 + 1 / 3600 ) ).to.be( '1°01′01″' ) ;
expect( format( '%m' , 1 + 59 / 60 + 59 / 3600 ) ).to.be( '1°59′59″' ) ;
expect( format( '%m' , - ( 1 + 59 / 60 + 59 / 3600 ) ) ).to.be( '-1°59′59″' ) ;
} ) ;
it( "%n natural" ) ;

@@ -272,0 +282,0 @@ it( "%N more natural" ) ;

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