@qntm-code/utils
Version:
A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.
24 lines (23 loc) • 762 B
JavaScript
/* eslint-disable prefer-rest-params */
import { isArguments } from './isArguments';
const strictArgs = (function (_a, _b, _c) {
'use strict';
return arguments;
})(1, 2, 3);
describe(`isArguments`, () => {
it(`should return true if value is an Arguments object`, () => {
const value = (function () {
return arguments;
})();
expect(isArguments(value)).toBe(true);
});
it(`should return true if value is an Arguments object (string)`, () => {
expect(isArguments(strictArgs)).toBe(true);
});
it(`should return false if value is not an Arguments object`, () => {
const value = (function () {
return;
})();
expect(isArguments(value)).toBe(false);
});
});