Skip to content

Commit

Permalink
Fix naming inconsistency
Browse files Browse the repository at this point in the history
Fixes #12
  • Loading branch information
sindresorhus committed Aug 9, 2020
1 parent 59e0ad2 commit 3f85cd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace oneTime {
declare namespace onetime {
interface Options {
/**
Throw an error when called more than once.
Expand All @@ -9,7 +9,7 @@ declare namespace oneTime {
}
}

declare const oneTime: {
declare const onetime: {
/**
Ensure a function is only called once. When called multiple times it will return the return value from the first call.
Expand All @@ -33,7 +33,7 @@ declare const oneTime: {
*/
<ArgumentsType extends unknown[], ReturnType>(
fn: (...arguments: ArgumentsType) => ReturnType,
options?: oneTime.Options
options?: onetime.Options
): (...arguments: ArgumentsType) => ReturnType;

/**
Expand All @@ -58,7 +58,7 @@ declare const oneTime: {
callCount(fn: (...arguments: any[]) => unknown): number;

// TODO: Remove this for the next major release
default: typeof oneTime;
default: typeof onetime;
};

export = oneTime;
export = onetime;
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const mimicFn = require('mimic-fn');

const calledFunctions = new WeakMap();

const oneTime = (function_, options = {}) => {
const onetime = (function_, options = {}) => {
if (typeof function_ !== 'function') {
throw new TypeError('Expected a function');
}
Expand Down Expand Up @@ -31,9 +31,9 @@ const oneTime = (function_, options = {}) => {
return onetime;
};

module.exports = oneTime;
module.exports = onetime;
// TODO: Remove this for the next major release
module.exports.default = oneTime;
module.exports.default = onetime;

module.exports.callCount = function_ => {
if (!calledFunctions.has(function_)) {
Expand Down

0 comments on commit 3f85cd4

Please sign in to comment.