New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@toddself/split-measure-units

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toddself/split-measure-units - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

16

dist/split-measure-units.js

@@ -24,12 +24,6 @@ 'use strict';

if (targetUnit && targetUnit !== unit) {
if (targetUnit === 'f') {
amount = (0, _tempConvert.toFahrenheit)(amount);
} else if (targetUnit === 'c') {
amount = (0, _tempConvert.toCelsius)(amount);
} else {
try {
amount = (0, _convertUnits2.default)(amount).from(unit).to(targetUnit);
} catch (err) {
return [0, ''];
}
try {
amount = (0, _convertUnits2.default)(amount).from(unit).to(targetUnit);
} catch (err) {
return [0, ''];
}

@@ -44,4 +38,2 @@ }

var _tempConvert = require('./temp-convert');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -48,0 +40,0 @@

{
"name": "@toddself/split-measure-units",
"version": "1.0.1",
"version": "1.1.0",
"description": "Separate English style measures (1 gal) into their amounts and units, and optionally convert to other units",

@@ -5,0 +5,0 @@ "main": "./dist/split-measure-units.js",

@@ -43,5 +43,5 @@ var test = require('tap').test

test('converts to fahrenheit', function (t) {
var results = splitMeasure('50c', 'f')
var results = splitMeasure('50C', 'F')
t.equal(results[0], 122, 'converted to f')
t.equal(results[1], 'f', 'got back f')
t.equal(results[1], 'F', 'got back F')
t.end()

@@ -51,6 +51,6 @@ })

test('converts to celsius', function (t) {
var results = splitMeasure('100f', 'c')
var results = splitMeasure('100F', 'C')
t.equal(Math.round(results[0]), Math.round(37.7), 'converted')
t.equal(results[1], 'c', 'got back c')
t.equal(results[1], 'C', 'got back C')
t.end()
})
import convert from 'convert-units'
import {toFahrenheit, toCelsius} from './temp-convert'

@@ -23,12 +22,6 @@ const matcher = /^([\d.]+)\ ?(.*$)/

if (targetUnit && targetUnit !== unit) {
if (targetUnit === 'f') {
amount = toFahrenheit(amount)
} else if (targetUnit === 'c') {
amount = toCelsius(amount)
} else {
try {
amount = convert(amount).from(unit).to(targetUnit)
} catch (err) {
return [0, '']
}
try {
amount = convert(amount).from(unit).to(targetUnit)
} catch (err) {
return [0, '']
}

@@ -35,0 +28,0 @@ }

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