Skip to content

Commit

Permalink
chore: convert every to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
mroderick committed Dec 29, 2023
1 parent c7bf5fe commit 048b79c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/every.cjs → lib/every.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
"use strict";

/**
* Returns true when fn returns true for all members of obj.
* This is an every implementation that works for all iterables
* @param {object} obj
* @param {Function} fn
* @returns {boolean}
*/
module.exports = function every(obj, fn) {
function every(obj, fn) {
var pass = true;

try {
Expand All @@ -24,3 +22,5 @@ module.exports = function every(obj, fn) {

return pass;
};

export default every;
7 changes: 3 additions & 4 deletions lib/every.test.cjs → lib/every.test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";
import pkg from "@sinonjs/referee-sinon";
const { assert, sinon } = pkg;

var assert = require("@sinonjs/referee-sinon").assert;
var sinon = require("@sinonjs/referee-sinon").sinon;
var every = require("./every.cjs");
import every from "./every.mjs";

describe("util/core/every", function () {
it("returns true when the callback function returns true for every element in an iterable", function () {
Expand Down
2 changes: 1 addition & 1 deletion lib/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import global from "./global.cjs";
import calledInOrder from "./called-in-order.mjs";
import className from "./class-name.mjs";
import * as deprecated from "./deprecated.js";
import every from "./every.cjs";
import every from "./every.mjs";
import functionName from "./function-name.cjs";
import orderByFirstCall from "./order-by-first-call.cjs";
import prototypes from "./prototypes/index.cjs";
Expand Down

0 comments on commit 048b79c

Please sign in to comment.