Skip to content

Commit

Permalink
chore: convert functionName to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
mroderick committed Dec 29, 2023
1 parent 048b79c commit a85a66f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/class-name.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import functionName from "./function-name.cjs";
import functionName from "./function-name.mjs";

/**
* Returns a display name for a value from a constructor
Expand Down
6 changes: 3 additions & 3 deletions lib/function-name.cjs → lib/function-name.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
"use strict";

/**
* Returns a display name for a function
* @param {Function} func
* @returns {string}
*/
module.exports = function functionName(func) {
function functionName(func) {
if (!func) {
return "";
}
Expand All @@ -26,3 +24,5 @@ module.exports = function functionName(func) {
return "";
}
};

export default functionName;
9 changes: 4 additions & 5 deletions lib/function-name.test.cjs → lib/function-name.test.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"use strict";
import { default as jsc } from "jsverify";
import pkg from "@sinonjs/referee-sinon";
const refute = pkg.refute;

var jsc = require("jsverify");
var refute = require("@sinonjs/referee-sinon").refute;

var functionName = require("./function-name.cjs");
import functionName from "./function-name.mjs";

describe("function-name", function () {
it("should return empty string if func is falsy", function () {
Expand Down
2 changes: 1 addition & 1 deletion lib/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import calledInOrder from "./called-in-order.mjs";
import className from "./class-name.mjs";
import * as deprecated from "./deprecated.js";
import every from "./every.mjs";
import functionName from "./function-name.cjs";
import functionName from "./function-name.mjs";
import orderByFirstCall from "./order-by-first-call.cjs";
import prototypes from "./prototypes/index.cjs";
import typeOf from "./type-of.cjs";
Expand Down

0 comments on commit a85a66f

Please sign in to comment.