tailwind-merge
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -1958,4 +1958,14 @@ import HLRU from 'hashlru'; | ||
return function callTailwindMerge(...classLists) { | ||
return functionToCall(classLists.join(' ')); | ||
return function callTailwindMerge() { | ||
let classList = ''; | ||
let temp; // Credits → https://github.com/lukeed/clsx/blob/v1.1.1/src/index.js | ||
for (let index = 0; index < arguments.length; index += 1) { | ||
if (temp = arguments[index]) { | ||
classList && (classList += ' '); | ||
classList += temp; | ||
} | ||
} | ||
return functionToCall(classList); | ||
}; | ||
@@ -1962,0 +1972,0 @@ } |
@@ -1976,3 +1976,13 @@ import HLRU from 'hashlru'; | ||
return function callTailwindMerge() { | ||
return functionToCall([].slice.call(arguments).join(' ')); | ||
var classList = ''; | ||
var temp; // Credits → https://github.com/lukeed/clsx/blob/v1.1.1/src/index.js | ||
for (var index = 0; index < arguments.length; index += 1) { | ||
if (temp = arguments[index]) { | ||
classList && (classList += ' '); | ||
classList += temp; | ||
} | ||
} | ||
return functionToCall(classList); | ||
}; | ||
@@ -1979,0 +1989,0 @@ } |
import { createTailwindMerge } from './tailwind-merge'; | ||
export declare const twMerge: (...classLists: (string | null | undefined)[]) => string; | ||
export declare const twMerge: (...classLists: (string | false | null | undefined)[]) => string; | ||
export { createTailwindMerge }; |
@@ -5,5 +5,5 @@ import { getDefaultConfig } from './default-config'; | ||
declare type ClassLists = ClassListElement[]; | ||
declare type ClassListElement = string | undefined | null; | ||
declare type ClassListElement = string | undefined | null | false; | ||
declare type TailwindMerge = (...classLists: ClassLists) => string; | ||
export declare function createTailwindMerge(createConfig: CreateConfig): TailwindMerge; | ||
export {}; |
{ | ||
"name": "tailwind-merge", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "Merge Tailwind CSS classes without style conflicts", | ||
@@ -62,6 +62,6 @@ "keywords": [ | ||
"ts-jest": "^27.0.3", | ||
"typescript": "^4.4.2", | ||
"typescript": "^4.4.3", | ||
"zx": "^4.0.0" | ||
}, | ||
"packageManager": "yarn@3.0.1" | ||
"packageManager": "yarn@3.0.2" | ||
} |
<div align="center"> | ||
<br /> | ||
<a href="https://github.com/dcastil/tailwind-merge"> | ||
<!-- AUTOGENERATED START logo-image --><img src="https://github.com/dcastil/tailwind-merge/raw/v0.6.0/assets/logo.svg" alt="tailwind-merge" width="221px" /><!-- AUTOGENERATED END --> | ||
<!-- AUTOGENERATED START logo-image --><img src="https://github.com/dcastil/tailwind-merge/raw/v0.7.0/assets/logo.svg" alt="tailwind-merge" width="221px" /><!-- AUTOGENERATED END --> | ||
</a> | ||
@@ -22,3 +22,3 @@ </div> | ||
- Fully typed | ||
- [<!-- AUTOGENERATED START package-gzip-size -->4.8 kB<!-- AUTOGENERATED END --> minified + gzipped](https://bundlephobia.com/package/tailwind-merge) (<!-- AUTOGENERATED START package-composition -->96.2% self, 3.8% hashlru<!-- AUTOGENERATED END -->) | ||
- [<!-- AUTOGENERATED START package-gzip-size -->4.8 kB<!-- AUTOGENERATED END --> minified + gzipped](https://bundlephobia.com/package/tailwind-merge) (<!-- AUTOGENERATED START package-composition -->96.3% self, 3.7% hashlru<!-- AUTOGENERATED END -->) | ||
@@ -130,6 +130,6 @@ ## Early development | ||
### Ignores `undefined` and `null` values | ||
### Ignores `undefined`, `null` and `false` values | ||
```ts | ||
twMerge('some-class', undefined, null) // → 'some-class' | ||
twMerge('some-class', undefined, null, false) // → 'some-class' | ||
``` | ||
@@ -144,3 +144,3 @@ | ||
```ts | ||
function twMerge(...classLists: Array<string | undefined | null>): string | ||
function twMerge(...classLists: Array<string | undefined | null | false>): string | ||
``` | ||
@@ -147,0 +147,0 @@ |
@@ -8,3 +8,3 @@ import { createConfigUtils } from './config-utils' | ||
type ClassLists = ClassListElement[] | ||
type ClassListElement = string | undefined | null | ||
type ClassListElement = string | undefined | null | false | ||
type TailwindMerge = (...classLists: ClassLists) => string | ||
@@ -41,5 +41,16 @@ type ConfigUtils = ReturnType<typeof createConfigUtils> | ||
return function callTailwindMerge(...classLists: ClassLists) { | ||
return functionToCall(classLists.join(' ')) | ||
return function callTailwindMerge() { | ||
let classList = '' | ||
let temp: ClassListElement | ||
// Credits → https://github.com/lukeed/clsx/blob/v1.1.1/src/index.js | ||
for (let index = 0; index < arguments.length; index += 1) { | ||
if ((temp = arguments[index])) { | ||
classList && (classList += ' ') | ||
classList += temp | ||
} | ||
} | ||
return functionToCall(classList) | ||
} | ||
} |
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
541253
8364