@airtasker/form-schema-compiler
Advanced tools
Comparing version 0.0.17 to 0.1.1
@@ -109,2 +109,2 @@ "use strict"; | ||
// [minimum version, maximum version] | ||
var COMPATIBLE_SCHEMA_VERSION = exports.COMPATIBLE_SCHEMA_VERSION = ["0.0.16", "0.0.17"]; | ||
var COMPATIBLE_SCHEMA_VERSION = exports.COMPATIBLE_SCHEMA_VERSION = ["0.0.16", "0.1.1"]; |
@@ -245,5 +245,2 @@ "use strict"; | ||
function readNext() { | ||
utils.readWhile(inputStream, utils.isWhitespace); | ||
var ch = inputStream.peek(); | ||
if (isStringTemplateMode) { | ||
@@ -253,2 +250,7 @@ return readTemplateLiteral(); | ||
// skip the white space if it is not in template literal | ||
utils.readWhile(inputStream, utils.isWhitespace); | ||
var ch = inputStream.peek(); | ||
if (shouldEnd(inputStream, ch)) { | ||
@@ -255,0 +257,0 @@ return null; |
@@ -17,4 +17,9 @@ "use strict"; | ||
var semvarToArray = function semvarToArray(version) { | ||
return version.split(".").map(Number); | ||
return version.split("."); | ||
}; | ||
var normalizeVersion = function normalizeVersion(versions) { | ||
return versions.map(function (version) { | ||
return version.padStart(4, '0'); | ||
}).join(''); | ||
}; | ||
@@ -32,5 +37,7 @@ var isVersionCompatible = exports.isVersionCompatible = function isVersionCompatible(version) { | ||
return versions.every(function (v, i) { | ||
return v >= min[i] && v <= max[i]; | ||
}); | ||
var versionStr = normalizeVersion(versions); | ||
var minStr = normalizeVersion(min); | ||
var maxStr = normalizeVersion(max); | ||
return versionStr >= minStr && versionStr <= maxStr; | ||
}; | ||
@@ -37,0 +44,0 @@ |
{ | ||
"name": "@airtasker/form-schema-compiler", | ||
"version": "0.0.17", | ||
"version": "0.1.1", | ||
"description": "a form schema compiler", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -127,2 +127,2 @@ export const TYPES = { | ||
// [minimum version, maximum version] | ||
export const COMPATIBLE_SCHEMA_VERSION = ["0.0.16", "0.0.17"]; | ||
export const COMPATIBLE_SCHEMA_VERSION = ["0.0.16", "0.1.1"]; |
@@ -227,9 +227,11 @@ import find from "lodash/find"; | ||
function readNext() { | ||
utils.readWhile(inputStream, utils.isWhitespace); | ||
const ch = inputStream.peek(); | ||
if (isStringTemplateMode) { | ||
return readTemplateLiteral(); | ||
} | ||
// skip the white space if it is not in template literal | ||
utils.readWhile(inputStream, utils.isWhitespace); | ||
const ch = inputStream.peek(); | ||
if (shouldEnd(inputStream, ch)) { | ||
@@ -236,0 +238,0 @@ return null; |
@@ -277,2 +277,20 @@ import createExpressionTokenStream from "./createExpressionTokenStream"; | ||
it("should support spacing line-break in template literal", () => { | ||
const stream = create("`\n \r \t`"); | ||
expect(stream.next()).toEqual({ | ||
type: TYPES.Punctuation, | ||
value: "`" | ||
}); | ||
expect(stream.next()).toEqual({ | ||
type: TYPES.String, | ||
value: "\n \r \t" | ||
}); | ||
expect(stream.next()).toEqual({ | ||
type: TYPES.Punctuation, | ||
value: "`" | ||
}); | ||
expect(stream.eof()).toBeTruthy(); | ||
}); | ||
it("should support complex template literal", () => { | ||
@@ -279,0 +297,0 @@ const stream = create("`'\"foo\"'\\{\\`{`1{1}`}bar`"); |
@@ -6,3 +6,4 @@ import { TYPES, COMPATIBLE_SCHEMA_VERSION } from "./const"; | ||
const semvarToArray = version => version.split(".").map(Number); | ||
const semvarToArray = version => version.split("."); | ||
const normalizeVersion = versions => versions.map(version => version.padStart(4, '0')).join(''); | ||
@@ -16,4 +17,7 @@ export const isVersionCompatible = version => { | ||
const [min, max] = COMPATIBLE_SCHEMA_VERSION.map(semvarToArray); | ||
const versionStr = normalizeVersion(versions); | ||
const minStr = normalizeVersion(min); | ||
const maxStr = normalizeVersion(max); | ||
return versions.every((v, i) => v >= min[i] && v <= max[i]); | ||
return versionStr >= minStr && versionStr <= maxStr; | ||
}; | ||
@@ -20,0 +24,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170034
64
4676