From 84a79bc90f62a0bd90d17214ac88ffa5249c4c40 Mon Sep 17 00:00:00 2001 From: Meqn Date: Mon, 23 Dec 2024 12:43:37 +0000 Subject: [PATCH] perf: Remove unused polyfill files and tests --- libs/polyfill/README.md | 1 - libs/polyfill/__tests__/assign.test.ts | 34 -------------------------- libs/polyfill/jest.config.js | 1 - libs/polyfill/object/assgin.ts | 31 ----------------------- libs/polyfill/package2.json | 13 ---------- libs/polyfill/tsconfig.json | 8 ------ 6 files changed, 88 deletions(-) delete mode 100644 libs/polyfill/README.md delete mode 100644 libs/polyfill/__tests__/assign.test.ts delete mode 100644 libs/polyfill/jest.config.js delete mode 100644 libs/polyfill/object/assgin.ts delete mode 100644 libs/polyfill/package2.json delete mode 100644 libs/polyfill/tsconfig.json diff --git a/libs/polyfill/README.md b/libs/polyfill/README.md deleted file mode 100644 index 5ea27d2..0000000 --- a/libs/polyfill/README.md +++ /dev/null @@ -1 +0,0 @@ -# polyfill diff --git a/libs/polyfill/__tests__/assign.test.ts b/libs/polyfill/__tests__/assign.test.ts deleted file mode 100644 index 94f046b..0000000 --- a/libs/polyfill/__tests__/assign.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import assign from '../object/assgin' - -describe('assign()', () => { - test('should return an object', () => { - expect(assign({}, {})).toEqual({}) - expect(assign({}, {}, {})).toEqual({}) - }) - test('should return an object with properties from all input objects', () => { - const target = {a: 1} - const source1 = {b: 2} - const source2 = {c: 3} - const result = assign(target, source1, source2) - expect(result).toEqual({a: 1, b: 2, c: 3}) - }) - test('should overwrite properties in target object with properties from input objects', () => { - const target = {a: 1, b: 2} - const source1 = {b: 3, c: 4} - const source2 = {c: 5} - const result = assign(target, source1, source2) - expect(result).toEqual({a: 1, b: 3, c: 5}) - }) - test('should throw an error if target input is undefined or null', () => { - expect(() => assign(undefined as any, {a: 1})).toThrow(TypeError) - expect(() => assign(null as any, {a: 1})).toThrow(TypeError) - }) - test('should change source object or not', () => { - const target = {} - const source1 = {a: 1} - expect(assign(target, source1) === target).toBe(true) - expect(assign({}, target, source1) === target).toBe(false) - expect(assign(target, source1) === source1).toBe(false) - expect(assign(target, source1)).toEqual(source1) - }) -}) diff --git a/libs/polyfill/jest.config.js b/libs/polyfill/jest.config.js deleted file mode 100644 index 50200e3..0000000 --- a/libs/polyfill/jest.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../jest.config') diff --git a/libs/polyfill/object/assgin.ts b/libs/polyfill/object/assgin.ts deleted file mode 100644 index 84751d7..0000000 --- a/libs/polyfill/object/assgin.ts +++ /dev/null @@ -1,31 +0,0 @@ -export default Object.assign || function(target: T): T { - if (target === undefined || target === null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - const len = arguments.length - for (let i = 1; i < len; i++) { - const source: T = arguments[i] - if (source !== undefined && source !== null) { - for (const key in source) { - if (source.hasOwnProperty(key)) { - target[key] = source[key] - } - } - } - } - return target -} - -/* -export function assign(target: T, source: U): T & U { - if (!isPlanObject(target)) return {} as T & U - if (!isPlanObject(source)) return target as T & U - - for (const key in source) { - if (source.hasOwnProperty(key)) { - (target as T & U)[key] = source[key] as any - } - } - return target as T & U -} -*/ diff --git a/libs/polyfill/package2.json b/libs/polyfill/package2.json deleted file mode 100644 index 356b1b5..0000000 --- a/libs/polyfill/package2.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "polyfill", - "private": true, - "version": "1.0.0", - "description": "", - "main": "jest.config.js", - "scripts": { - "test": "jest" - }, - "keywords": [], - "author": "", - "license": "ISC" -} diff --git a/libs/polyfill/tsconfig.json b/libs/polyfill/tsconfig.json deleted file mode 100644 index fd5058d..0000000 --- a/libs/polyfill/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../build/tsconfig.simple.json", - "compilerOptions": { - "target": "ES5", - "declaration": false, - }, - "include": ["src"] -}