Comparing version 2.1.0 to 2.1.1
@@ -1,1 +0,1 @@ | ||
export default function isValidColor(input: any): boolean; | ||
export default function isValidColor(input: unknown): boolean; |
@@ -1,1 +0,1 @@ | ||
export default function isValidHex(input: any): boolean; | ||
export default function isValidHex(input: any, alpha?: boolean): boolean; |
import { isString } from './modules/utils'; | ||
export default function isValidHex(input) { | ||
export default function isValidHex(input, alpha = true) { | ||
if (!isString(input)) { | ||
return false; | ||
} | ||
return /^#([\da-f]{3,4}|[\da-f]{6,8})$/i.test(input); | ||
if (alpha) { | ||
return /^#([\da-f]{3,4}|[\da-f]{6,8})$/i.test(input); | ||
} | ||
return /^#([\da-f]{3}|[\da-f]{6})$/i.test(input); | ||
} | ||
//# sourceMappingURL=is-valid-hex.js.map |
@@ -5,2 +5,2 @@ import { ColorTypes, Return } from './types'; | ||
*/ | ||
export default function parseCSS<T extends ColorTypes = 'hex'>(input: string, output?: T): Return<T>; | ||
export default function parseCSS<T extends ColorTypes = 'hex'>(input: unknown, output?: T): Return<T>; |
@@ -1,1 +0,1 @@ | ||
export default function isValidColor(input: any): boolean; | ||
export default function isValidColor(input: unknown): boolean; |
@@ -1,1 +0,1 @@ | ||
export default function isValidHex(input: any): boolean; | ||
export default function isValidHex(input: any, alpha?: boolean): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const utils_1 = require("./modules/utils"); | ||
function isValidHex(input) { | ||
function isValidHex(input, alpha = true) { | ||
if (!(0, utils_1.isString)(input)) { | ||
return false; | ||
} | ||
return /^#([\da-f]{3,4}|[\da-f]{6,8})$/i.test(input); | ||
if (alpha) { | ||
return /^#([\da-f]{3,4}|[\da-f]{6,8})$/i.test(input); | ||
} | ||
return /^#([\da-f]{3}|[\da-f]{6})$/i.test(input); | ||
} | ||
exports.default = isValidHex; | ||
//# sourceMappingURL=is-valid-hex.js.map |
@@ -5,2 +5,2 @@ import { ColorTypes, Return } from './types'; | ||
*/ | ||
export default function parseCSS<T extends ColorTypes = 'hex'>(input: string, output?: T): Return<T>; | ||
export default function parseCSS<T extends ColorTypes = 'hex'>(input: unknown, output?: T): Return<T>; |
{ | ||
"name": "colorizr", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Manipulate colors like a boss", | ||
@@ -5,0 +5,0 @@ "author": "Gil Barbara <gilbarbara@gmail.com>", |
import parseCSS from './parse-css'; | ||
export default function isValidColor(input: any): boolean { | ||
export default function isValidColor(input: unknown): boolean { | ||
try { | ||
@@ -5,0 +5,0 @@ parseCSS(input); |
import { isString } from './modules/utils'; | ||
export default function isValidHex(input: any): boolean { | ||
export default function isValidHex(input: any, alpha = true): boolean { | ||
if (!isString(input)) { | ||
@@ -8,3 +8,7 @@ return false; | ||
return /^#([\da-f]{3,4}|[\da-f]{6,8})$/i.test(input); | ||
if (alpha) { | ||
return /^#([\da-f]{3,4}|[\da-f]{6,8})$/i.test(input); | ||
} | ||
return /^#([\da-f]{3}|[\da-f]{6})$/i.test(input); | ||
} |
@@ -16,3 +16,3 @@ import hex2hsl from './hex2hsl'; | ||
export default function parseCSS<T extends ColorTypes = 'hex'>( | ||
input: string, | ||
input: unknown, | ||
output?: T, | ||
@@ -19,0 +19,0 @@ ): Return<T> { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
240851
4746
0