From 22fda8191690aff0a9f3704293b2e88ac7ce3eec Mon Sep 17 00:00:00 2001 From: wiktord2000 Date: Mon, 23 Oct 2023 15:53:01 +0200 Subject: [PATCH] [AAE-17103] Remove typeof pipe --- lib/core/src/lib/pipes/typeof.pipe.spec.ts | 81 ---------------------- lib/core/src/lib/pipes/typeof.pipe.ts | 30 -------- 2 files changed, 111 deletions(-) delete mode 100644 lib/core/src/lib/pipes/typeof.pipe.spec.ts delete mode 100644 lib/core/src/lib/pipes/typeof.pipe.ts diff --git a/lib/core/src/lib/pipes/typeof.pipe.spec.ts b/lib/core/src/lib/pipes/typeof.pipe.spec.ts deleted file mode 100644 index 37b3a37bfac..00000000000 --- a/lib/core/src/lib/pipes/typeof.pipe.spec.ts +++ /dev/null @@ -1,81 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { TypeofPipe } from './typeof.pipe'; - -describe('TypeofPipe', () => { - let pipe: TypeofPipe; - - beforeEach(() => { - pipe = new TypeofPipe(); - }); - - it('should return "string"', () => { - const testStrings = ['', 'number', 'boolean', 'object', 'function', 'symbol', - 'undefined', 'bigint', 'false', 'true', '0', '1', '{}', '[]', '1n']; - - testStrings.forEach((testString) => { - expect(pipe.transform(testString)).toBe('string'); - }); - }); - - it('should return "number"', () => { - const testNumbers = [-100, -1, 0, 1, 20, Infinity, -Infinity, NaN]; - testNumbers.forEach((testNumber) => { - expect(pipe.transform(testNumber)).toBe('number'); - }); - }); - - it('should return "boolean"', () => { - const testBooleans = [true, false]; - testBooleans.forEach((testBoolean) => { - expect(pipe.transform(testBoolean)).toBe('boolean'); - }); - }); - - it('should return "object"', () => { - const testObjects = [{}, { foo: 'bar' }, { foo: { bar: 'baz' } }, [], new Date(), /hello/, new Map(), new Set()]; - testObjects.forEach((testObject) => { - expect(pipe.transform(testObject)).toBe('object'); - }); - }); - - it('should return "function"', () => { - const testFunctions = [() => {}, function () {}, class Foo {}]; - testFunctions.forEach((testFunction) => { - expect(pipe.transform(testFunction)).toBe('function'); - }); - }); - - it('should return "symbol"', () => { - const testSymbols = [Symbol(), Symbol('foo')]; - testSymbols.forEach((testSymbol) => { - expect(pipe.transform(testSymbol)).toBe('symbol'); - }); - }); - - it('should return "undefined"', () => { - expect(pipe.transform(undefined)).toBe('undefined'); - }); - - it('should return "bigint"', () => { - const testBigInts = [BigInt(0), BigInt(1), BigInt(100), BigInt(-1), BigInt(-100)]; - testBigInts.forEach((testBigInt) => { - expect(pipe.transform(testBigInt)).toBe('bigint'); - }); - }); -}); diff --git a/lib/core/src/lib/pipes/typeof.pipe.ts b/lib/core/src/lib/pipes/typeof.pipe.ts deleted file mode 100644 index 673fe6c96ca..00000000000 --- a/lib/core/src/lib/pipes/typeof.pipe.ts +++ /dev/null @@ -1,30 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Pipe, PipeTransform } from '@angular/core'; - -export type TypeOfValue = 'string' | 'number' | 'boolean' | 'object' | 'function' | 'symbol' | 'undefined' | 'bigint'; - -@Pipe({ - name: 'adfTypeof', - standalone: true -}) -export class TypeofPipe implements PipeTransform { - transform(value: any): TypeOfValue { - return typeof value as TypeOfValue; - } -}