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

@flourish/interpreter

Package Overview
Dependencies
Maintainers
32
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flourish/interpreter - npm Package Compare versions

Comparing version 6.0.2 to 6.0.3

5

interpreter.js

@@ -937,5 +937,8 @@ (function (global, factory) {

}
return Object.freeze({
test: test,
parse: shield(function(str) { return parser(str) || customDatetimeParser(CUSTOM_FORMAT_REGEXES[format_string])(str); }),
parse: shield(function(str) {
return parser(str) || (CUSTOM_FORMAT_REGEXES[format_string] ? customDatetimeParser(CUSTOM_FORMAT_REGEXES[format_string])(str) : null);
}),
format: function(dt) { return formatter(dt); },

@@ -942,0 +945,0 @@ type: "datetime",

2

package.json
{
"name": "@flourish/interpreter",
"version": "6.0.2",
"version": "6.0.3",
"description": "Does a best guess at the type of data supplied",

@@ -5,0 +5,0 @@ "main": "interpreter.js",

@@ -0,1 +1,4 @@

# 6.0.3
* Interpret non-parseable datetime strings as strings
# 6.0.2

@@ -2,0 +5,0 @@ * Add datetime interpretations for strings containing 4-letter month abbreviations

@@ -67,5 +67,8 @@ import { timeFormat, timeParse } from "d3-time-format";

}
return Object.freeze({
test: test,
parse: shield(function(str) { return parser(str) || customDatetimeParser(CUSTOM_FORMAT_REGEXES[format_string])(str); }),
parse: shield(function(str) {
return parser(str) || (CUSTOM_FORMAT_REGEXES[format_string] ? customDatetimeParser(CUSTOM_FORMAT_REGEXES[format_string])(str) : null);
}),
format: function(dt) { return formatter(dt); },

@@ -72,0 +75,0 @@ type: "datetime",

@@ -205,2 +205,19 @@ const { expect } = require("chai");

});
it("should parse empty strings as null", () => {
var datetime_ids = createInterpreter.DATETIME_IDS;
datetime_ids.forEach(id => {
const interpretation = createInterpreter.getInterpretation(id);
expect(interpretation.parse("") === null).to.equal(true);
});
});
it("should parse non-empty strings that do not represent validly formatted dates as null", () => {
const values = ["doremifasola", "!-+%$^", "111222333"]; // strings that definitely do not represent validly formatted datetimes
var datetime_ids = createInterpreter.DATETIME_IDS;
datetime_ids.forEach(id => {
const interpretation = createInterpreter.getInterpretation(id);
expect(values.every(d => interpretation.parse(d) === null)).to.equal(true);
});
});
});

@@ -207,0 +224,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