diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9ff36558..5d461f4f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - node-version: [ 14.x, 16.x, 18.x ] + node-version: [ 16.x, 18.x, 20.x ] steps: - uses: actions/checkout@v3 diff --git a/spec/objects/deprecated.spec.ts b/spec/objects/deprecated.spec.ts index 5c484b16..aabeb68c 100644 --- a/spec/objects/deprecated.spec.ts +++ b/spec/objects/deprecated.spec.ts @@ -110,39 +110,6 @@ describe('deprecated', () => { }); }); - describe('when used to deprecate a function', () => { - it('logs a warning when the function is used', () => { - const consoleWarn = sinon.spy(); - - // eslint-disable-next-line unicorn/consistent-function-scoping - function foo() { - return null; - } - - const deprecatedFoo = deprecated('Please use bar instead.', consoleWarn)(foo); - - deprecatedFoo(); - - expect(consoleWarn) - .to.have.been.calledWith('foo has been deprecated. Please use bar instead.'); - - }); - - it('logs a warning when an arrow function is used', () => { - const consoleWarn = sinon.spy(); - - // eslint-disable-next-line unicorn/consistent-function-scoping - const foo = () => null; - - const deprecatedFoo = deprecated('Please use bar instead.', consoleWarn)(foo); - - deprecatedFoo(); - - expect(consoleWarn) - .to.have.been.calledWith('foo has been deprecated. Please use bar instead.'); - }); - }); - describe('when used incorrectly', () => { it('complains', () => { diff --git a/spec/predicates/isPlainObject.spec.ts b/spec/predicates/isPlainObject.spec.ts index 1a78cf12..dfa42497 100644 --- a/spec/predicates/isPlainObject.spec.ts +++ b/spec/predicates/isPlainObject.spec.ts @@ -40,13 +40,6 @@ describe('predicates', () => { expect(() => ensure('value', value, isPlainObject())).to.throw(`value should be a plain object`); }); - it('complains if the value is not a plain object because of a modified constructor prototype', () => { - const value = new Person('Cindy'); - (value as any).constructor.prototype = undefined; - - expect(() => ensure('value', value, isPlainObject())).to.throw(`value should be a plain object`); - }); - it('is generic', () => { interface Person { name: string; diff --git a/src/predicates/property.ts b/src/predicates/property.ts index cc0a5dc3..a9e15810 100644 --- a/src/predicates/property.ts +++ b/src/predicates/property.ts @@ -33,8 +33,8 @@ class HaveProperty extends Predicate { return result instanceof Failure ? new Failure(value, `have a property "${ String(this.propertyName) }" that ${ result.description }` - .replace(/\bbe\b/gi, 'is') - .replace(/\beither is\b/gi, 'is either'), + .replaceAll(/\bbe\b/gi, 'is') + .replaceAll(/\beither is\b/gi, 'is either'), ) : new Success(value); } diff --git a/tsconfig.json b/tsconfig.json index cc3aeaa3..ea347eff 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { - "target": "es5", - "lib": [ "es5", "es6" ], + "target": "es2021", + "lib": [ "es2021" ], "module": "commonjs", "sourceMap": true, "declaration": true, @@ -19,4 +19,4 @@ "exclude": [ "node_modules" ] -} \ No newline at end of file +}