Skip to content

Commit

Permalink
Merge pull request #239 from ambar/fix-bundler-compatibility
Browse files Browse the repository at this point in the history
Fix bundler compatibility
  • Loading branch information
jgerigmeyer authored Nov 8, 2022
2 parents 0b3caca + 38438d8 commit 288511f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
10 changes: 0 additions & 10 deletions src/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ export default class Color {
}

static defineFunction (name, code, o = code) {
if (arguments.length === 1) {
[name, code, o] = [arguments[0].name, arguments[0], arguments[0]];
}

let {instance = true, returns} = o;

let func = function (...args) {
Expand Down Expand Up @@ -168,12 +164,6 @@ export default class Color {
if (exports.register) {
exports.register(Color);
}
else if (exports.default) {
Color.defineFunction(exports.default.name, exports.default);
}
else if (typeof exports === "function") {
Color.defineFunction(exports);
}
else {
// No register method, just add the module's functions
for (let name in exports) {
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import Color from "./color.js";
import "./spaces/index.js";

// Import all DeltaE methods
import * as deltaE from "./deltaE.js";
import deltaE from "./deltaE.js";
import * as deltaEMethods from "./deltaE/index.js";

Color.extend(deltaEMethods);
Color.extend(deltaE);
Color.extend({deltaE});

// Import optional modules
import * as variations from "./variations.js";
Color.extend(variations);

import contrast from "./contrast.js";
Color.extend(contrast);
Color.extend({contrast});

import * as chromaticity from "./chromaticity.js";
Color.extend(chromaticity);
Expand Down
3 changes: 0 additions & 3 deletions types/src/color.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ declare class Color {
alpha: number
): Color;

static defineFunction(code: DefineFunctionHybrid): void;
static defineFunction(name: string, code: DefineFunctionHybrid): void;
static defineFunction(
name: string,
Expand All @@ -102,9 +101,7 @@ declare class Color {

static extend(
exports:
| DefineFunctionHybrid
| { register: (color: typeof Color) => void }
| { default: DefineFunctionHybrid }
| Record<string, DefineFunctionHybrid>
): void;

Expand Down

0 comments on commit 288511f

Please sign in to comment.