├── CHANGELOG.md ├── CHANGELOG.md.meta ├── Editor.meta ├── Editor ├── ObjectExtensions.cs ├── ObjectExtensions.cs.meta ├── TNRD.Extensions.Editor.asmdef └── TNRD.Extensions.Editor.asmdef.meta ├── LICENSE.md ├── LICENSE.md.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── ArrayExtensions.cs ├── ArrayExtensions.cs.meta ├── GameObjectExtensions.cs ├── GameObjectExtensions.cs.meta ├── LinqExtensions.cs ├── LinqExtensions.cs.meta ├── ListExtensions.cs ├── ListExtensions.cs.meta ├── MathExtensions.cs ├── MathExtensions.cs.meta ├── ObjectExtensions.cs ├── ObjectExtensions.cs.meta ├── StringExtensions.cs ├── StringExtensions.cs.meta ├── TNRD.Extensions.asmdef └── TNRD.Extensions.asmdef.meta ├── Tests.meta ├── Tests ├── Editor.meta ├── Runtime.meta └── Runtime │ ├── ArrayTests.cs │ ├── ArrayTests.cs.meta │ ├── LinqTests.cs │ ├── LinqTests.cs.meta │ ├── ListTests.cs │ ├── ListTests.cs.meta │ ├── MathTests.cs │ ├── MathTests.cs.meta │ ├── StringTests.cs │ ├── StringTests.cs.meta │ ├── TNRD.Extensions.Tests.asmdef │ └── TNRD.Extensions.Tests.asmdef.meta ├── package.json └── package.json.meta /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [2.1.0] - 2020-07-11 4 | ### Added 5 | - Array extensions 6 | - IsWithinBounds for other dimensions 7 | 8 | ## [2.0.0] - 2020-03-05 9 | ### Added 10 | - Array extensions 11 | - IsWithinBounds 12 | - GameObject extensions 13 | - SetParent 14 | - Linq extensions 15 | - None 16 | - List extensions 17 | - IsNullOrEmpty 18 | - Math extensions 19 | - Clamp 20 | - Object extensions 21 | - IsNull 22 | - IsNotNull 23 | - GetAssetPath 24 | - GetAssetGuid 25 | 26 | ## [1.0.0] - 2020-02-25 27 | ### Added 28 | - String extensions 29 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a0c31703c35ac64ba430c77ad176a12 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 30ccde5889caecb4796e0661b6bcb737 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/ObjectExtensions.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UnityEditor 4 | { 5 | public static class ObjectExtensions 6 | { 7 | public static string GetAssetPath(this Object obj) 8 | { 9 | return AssetDatabase.GetAssetPath(obj); 10 | } 11 | 12 | public static string GetAssetGuid(this Object obj) 13 | { 14 | return AssetDatabase.AssetPathToGUID(GetAssetPath(obj)); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Editor/ObjectExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c98153d51865e4a4fbd809926983d2bd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/TNRD.Extensions.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TNRD.Extensions.Editor", 3 | "references": [], 4 | "includePlatforms": [ 5 | "Editor" 6 | ], 7 | "excludePlatforms": [], 8 | "allowUnsafeCode": false, 9 | "overrideReferences": false, 10 | "precompiledReferences": [], 11 | "autoReferenced": true, 12 | "defineConstraints": [], 13 | "versionDefines": [], 14 | "noEngineReferences": false 15 | } 16 | -------------------------------------------------------------------------------- /Editor/TNRD.Extensions.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6131287398ac7364d87d31d4f11f3929 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Christiaan Bloemendaal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fc9aa0e952a05342a4c8ba5663aaa1d 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Extensions 2 | 3 |

4 | GitHub package.json version 5 | 6 | GitHub issues 7 | 8 | 9 | GitHub pull requests 10 | 11 | 12 | GitHub license 13 | 14 | GitHub last commit 15 |

16 | 17 | Extensions is a simple collection of extensions that I find useful when working with Unity and C#. 18 | 19 | ## Usage 20 | The extensions that are currently implemented are for the following classes 21 | 22 | * [Array](https://github.com/Thundernerd/Unity3D-Extensions/blob/master/Runtime/ArrayExtensions.cs) 23 | * [GameObject](https://github.com/Thundernerd/Unity3D-Extensions/blob/master/Runtime/GameObjectExtensions.cs) 24 | * [Linq](https://github.com/Thundernerd/Unity3D-Extensions/blob/master/Runtime/LinqExtensions.cs) 25 | * [List](https://github.com/Thundernerd/Unity3D-Extensions/blob/master/Runtime/ListExtensions.cs) 26 | * [Math](https://github.com/Thundernerd/Unity3D-Extensions/blob/master/Runtime/MathExtensions.cs) 27 | * [Object (runtime)](https://github.com/Thundernerd/Unity3D-Extensions/blob/master/Runtime/ObjectExtensions.cs) 28 | * [Object (editor)](https://github.com/Thundernerd/Unity3D-Extensions/blob/master/Editor/ObjectExtensions.cs) 29 | * [String](https://github.com/Thundernerd/Unity3D-Extensions/blob/master/Runtime/StringExtensions.cs) 30 | 31 | ## Contributing 32 | Pull requests are welcomed. Please feel free to fix any issues you find, or add new features. 33 | 34 | ## Installing 35 | Installing Extensions into your Unity3D project is done through the [Package Manager](https://docs.unity3d.com/Manual/Packages.html). 36 | 37 | You can either add the package manually to the [manifest.json](https://docs.unity3d.com/Manual/upm-dependencies.html) file: 38 | ```json 39 | { 40 | "dependencies": { 41 | "net.tnrd.extensions": "https://github.com/Thundernerd/Unity3D-Extensions.git" 42 | } 43 | } 44 | ``` 45 | 46 | Or add it through the UI by selecting the **+ button** in the top left of the Package Manager, selecting _Add package from git URL..._, and pasting https://github.com/Thundernerd/Unity3D-Extensions.git in the input field. 47 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf04fa7a6bea44340804064206ba582a 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e60acc7a2d8ef6848a64d44ec8229818 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/ArrayExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace System 2 | { 3 | public static class ArrayExtensions 4 | { 5 | public static bool IsWithinBounds(this Array array, int i) 6 | { 7 | return IsWithinBounds(array, i, 0); 8 | } 9 | 10 | public static bool IsWithinBounds(this Array array, int i, int dimension) 11 | { 12 | int lower = array.GetLowerBound(dimension); 13 | int upper = array.GetUpperBound(dimension); 14 | return i >= lower && i <= upper; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Runtime/ArrayExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: feecf4c303a94ec3b5b2d1593406b949 3 | timeCreated: 1583338553 -------------------------------------------------------------------------------- /Runtime/GameObjectExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace UnityEngine 2 | { 3 | public static class GameObjectExtensions 4 | { 5 | public static void SetParent(this GameObject gameObject, GameObject parent) 6 | { 7 | gameObject.transform.SetParent(parent.transform); 8 | } 9 | 10 | public static void SetParent(this GameObject gameObject, GameObject parent, bool worldPositionStays) 11 | { 12 | gameObject.transform.SetParent(parent.transform, worldPositionStays); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Runtime/GameObjectExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7533bee711834055b00edb8acba30d40 3 | timeCreated: 1583338356 -------------------------------------------------------------------------------- /Runtime/LinqExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace System.Linq 4 | { 5 | public static class LinqExtensions 6 | { 7 | public static bool None(this IEnumerable source, Func predicate) 8 | { 9 | return !source.Any(predicate); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Runtime/LinqExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d488207f40974107a41eac23bd9e0639 3 | timeCreated: 1583338693 -------------------------------------------------------------------------------- /Runtime/ListExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace System.Collections 2 | { 3 | public static class ListExtensions 4 | { 5 | public static bool IsNullOrEmpty(this IList list) 6 | { 7 | return list == null || list.Count == 0; 8 | } 9 | } 10 | } 11 | 12 | namespace System.Collections.Generic 13 | { 14 | public static class GenericListExtensions 15 | { 16 | public static bool IsNullOrEmpty(this IList list) 17 | { 18 | return list == null || list.Count == 0; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Runtime/ListExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a5093aa3ff5e7c47b63574adfe0ccd8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/MathExtensions.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public static class MathExtensions 4 | { 5 | public static int Clamp(this int value, int min, int max) 6 | { 7 | return Mathf.Clamp(value, min, max); 8 | } 9 | 10 | public static float Clamp(this float value, float min, float max) 11 | { 12 | return Mathf.Clamp(value, min, max); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Runtime/MathExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4b35c835ec1456f92e764bb48c56b5f 3 | timeCreated: 1583338786 -------------------------------------------------------------------------------- /Runtime/ObjectExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace UnityEngine 2 | { 3 | public static class ObjectExtensions 4 | { 5 | public static bool IsNull(this Object obj) 6 | { 7 | return ((object) obj) == null; 8 | } 9 | 10 | public static bool IsNotNull(this Object obj) 11 | { 12 | return ((object) obj) != null; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Runtime/ObjectExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22daf3b2d9d847da986e406374f4ff5b 3 | timeCreated: 1583338890 -------------------------------------------------------------------------------- /Runtime/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | public static class StringExtensions 2 | { 3 | public static bool IsNullOrEmpty(this string str) 4 | { 5 | return string.IsNullOrEmpty(str); 6 | } 7 | 8 | public static bool IsNullOrWhiteSpace(this string str) 9 | { 10 | return string.IsNullOrWhiteSpace(str); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Runtime/StringExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26c24f5e3da11114abc15d3e35be86ec 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/TNRD.Extensions.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TNRD.Extensions", 3 | "references": [], 4 | "includePlatforms": [], 5 | "excludePlatforms": [], 6 | "allowUnsafeCode": false, 7 | "overrideReferences": false, 8 | "precompiledReferences": [], 9 | "autoReferenced": true, 10 | "defineConstraints": [], 11 | "versionDefines": [], 12 | "noEngineReferences": false 13 | } 14 | -------------------------------------------------------------------------------- /Runtime/TNRD.Extensions.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3ac6cc9bb244a2408ba9716029acc0f 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b22aa5ace42e66d4d89902b3f5966405 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b999f44b4027461196d63bc67a8b8924 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0541a8215a1f8445a94a82b622a6730 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Runtime/ArrayTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using Random = UnityEngine.Random; 4 | 5 | namespace TNRD.Extensions.Tests 6 | { 7 | [TestFixture] 8 | public class ArrayTests 9 | { 10 | private const int MIN = 10; 11 | private const int MAX = 100; 12 | 13 | [Test] 14 | public void SingleIsWithinBounds() 15 | { 16 | int length = Random.Range(MIN, MAX); 17 | int[] array = new int[length]; 18 | Assert.IsTrue(array.IsWithinBounds(Random.Range(0, length - 1))); 19 | } 20 | 21 | [Test] 22 | public void MultiIsWithinBounds() 23 | { 24 | int first = Random.Range(MIN, MAX); 25 | int second = Random.Range(MIN, MAX); 26 | int[,] array = new int[first, second]; 27 | Assert.IsTrue(array.IsWithinBounds(Random.Range(0, first - 1), 0)); 28 | Assert.IsTrue(array.IsWithinBounds(Random.Range(0, second - 1), 1)); 29 | } 30 | 31 | [Test] 32 | public void SingleIsNotWithinBounds() 33 | { 34 | int length = Random.Range(MIN, MAX); 35 | int[] array = new int[length]; 36 | Assert.IsFalse(array.IsWithinBounds(MAX + 1)); 37 | } 38 | 39 | [Test] 40 | public void MultiIsNotWithinBounds() 41 | { 42 | int first = Random.Range(MIN, MAX); 43 | int second = Random.Range(MIN, MAX); 44 | int[,] array = new int[first, second]; 45 | Assert.IsFalse(array.IsWithinBounds(MAX + 1, 0)); 46 | Assert.IsFalse(array.IsWithinBounds(MAX + 1, 1)); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Tests/Runtime/ArrayTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45ab45db373a479fa6975a0cb0949fd6 3 | timeCreated: 1583421145 -------------------------------------------------------------------------------- /Tests/Runtime/LinqTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using NUnit.Framework; 4 | 5 | namespace TNRD.Extensions.Tests 6 | { 7 | [TestFixture] 8 | public class LinqTests 9 | { 10 | [Test] 11 | public void None() 12 | { 13 | List dummy = new List 14 | { 15 | 1, 2, 4, 5 16 | }; 17 | 18 | Assert.IsTrue(dummy.None(x => x == 3)); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Tests/Runtime/LinqTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ea0ed2839d24789b2b47944e41cd73a 3 | timeCreated: 1583421157 -------------------------------------------------------------------------------- /Tests/Runtime/ListTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using NUnit.Framework; 3 | 4 | namespace TNRD.Extensions.Tests 5 | { 6 | [TestFixture] 7 | public class ListTests 8 | { 9 | [Test] 10 | public void IsNullOrEmpty_Null() 11 | { 12 | List dummy = null; 13 | Assert.IsTrue(dummy.IsNullOrEmpty()); 14 | } 15 | 16 | [Test] 17 | public void IsNullOrEmpty_Empty() 18 | { 19 | List dummy = new List(); 20 | Assert.IsTrue(dummy.IsNullOrEmpty()); 21 | } 22 | 23 | [Test] 24 | public void IsNullOrEmpty_Filled() 25 | { 26 | List dummy = new List 27 | { 28 | 1, 2, 3, 4, 5 29 | }; 30 | Assert.IsFalse(dummy.IsNullOrEmpty()); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Tests/Runtime/ListTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 865144665fbc44f39c10bf247de7868b 3 | timeCreated: 1583421162 -------------------------------------------------------------------------------- /Tests/Runtime/MathTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using UnityEngine; 3 | 4 | namespace TNRD.Extensions.Tests 5 | { 6 | [TestFixture] 7 | internal class MathTests 8 | { 9 | private const float FLOAT_MAX = 10.6f; 10 | private const float FLOAT_MIN = 5.25f; 11 | private const int INT_MAX = 10; 12 | private const int INT_MIN = 5; 13 | 14 | [Test] 15 | public void Clamp_Float_OverMax() 16 | { 17 | float foo = Random.Range(FLOAT_MAX * 2, FLOAT_MAX * 10); 18 | Assert.IsTrue(foo.Clamp(FLOAT_MIN, FLOAT_MAX) == FLOAT_MAX); 19 | } 20 | 21 | [Test] 22 | public void Clamp_Float_UnderMin() 23 | { 24 | float foo = Random.Range(0, FLOAT_MIN * 0.95f); 25 | Assert.IsTrue(foo.Clamp(FLOAT_MIN, FLOAT_MAX) == FLOAT_MIN); 26 | } 27 | 28 | [Test] 29 | public void Clamp_Float_InBetween() 30 | { 31 | float foo = Random.Range(FLOAT_MIN, FLOAT_MAX); 32 | Assert.IsTrue(foo.Clamp(FLOAT_MIN, FLOAT_MAX) == foo); 33 | } 34 | 35 | [Test] 36 | public void Clamp_Int_OverMax() 37 | { 38 | int foo = Random.Range(INT_MAX * 2, INT_MAX * 10); 39 | Assert.IsTrue(foo.Clamp(INT_MIN, INT_MAX) == INT_MAX); 40 | } 41 | 42 | [Test] 43 | public void Clamp_Int_UnderMin() 44 | { 45 | int foo = Random.Range(0, INT_MIN); 46 | Assert.IsTrue(foo.Clamp(INT_MIN, INT_MAX) == INT_MIN); 47 | } 48 | 49 | [Test] 50 | public void Clamp_Int_InBetween() 51 | { 52 | int foo = Random.Range(INT_MIN, INT_MAX); 53 | Assert.IsTrue(foo.Clamp(INT_MIN, INT_MAX) == foo); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Tests/Runtime/MathTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f65b3ac982d4ca4bc08dea7e8dadc90 3 | timeCreated: 1583420529 -------------------------------------------------------------------------------- /Tests/Runtime/StringTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace TNRD.Extensions.Tests 4 | { 5 | [TestFixture] 6 | internal class StringTests 7 | { 8 | [Test] 9 | public void IsNullOrEmpty_Null() 10 | { 11 | string foo = null; 12 | Assert.IsTrue(foo.IsNullOrEmpty()); 13 | } 14 | 15 | [Test] 16 | public void IsNullOrEmpty_Empty() 17 | { 18 | Assert.IsTrue("".IsNullOrEmpty()); 19 | } 20 | 21 | [Test] 22 | public void IsNullOrEmpty_Filled() 23 | { 24 | Assert.IsFalse("Hello, World!".IsNullOrEmpty()); 25 | } 26 | 27 | [Test] 28 | public void IsNullOrWhiteSpace_Null() 29 | { 30 | string foo = null; 31 | Assert.IsTrue(foo.IsNullOrWhiteSpace()); 32 | } 33 | 34 | [Test] 35 | public void IsNullOrWhiteSpace_WhiteSpace() 36 | { 37 | Assert.IsTrue(" ".IsNullOrWhiteSpace()); 38 | } 39 | 40 | [Test] 41 | public void IsNullOrWhiteSpace_Empty() 42 | { 43 | Assert.IsTrue("".IsNullOrWhiteSpace()); 44 | } 45 | 46 | [Test] 47 | public void IsNullOrWhiteSpace_Filled() 48 | { 49 | Assert.IsFalse("Hello, World!".IsNullOrWhiteSpace()); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Tests/Runtime/StringTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ce8eeca7927c024fafa0ffe4c74d87b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Runtime/TNRD.Extensions.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TNRD.Extensions.Tests", 3 | "references": [ 4 | "TNRD.Extensions" 5 | ], 6 | "includePlatforms": [ 7 | "Editor" 8 | ], 9 | "excludePlatforms": [], 10 | "allowUnsafeCode": false, 11 | "overrideReferences": true, 12 | "precompiledReferences": [ 13 | "nunit.framework.dll" 14 | ], 15 | "autoReferenced": false, 16 | "defineConstraints": [], 17 | "versionDefines": [], 18 | "noEngineReferences": false 19 | } 20 | -------------------------------------------------------------------------------- /Tests/Runtime/TNRD.Extensions.Tests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4776e72e701a1814fa1d52b2ee843c3f 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "net.tnrd.extensions", 3 | "version": "2.1.0", 4 | "displayName": "Extension Collection", 5 | "description": "A collection of extensions", 6 | "unity": "2019.1", 7 | "keywords": [ 8 | "extension", 9 | "extensions" 10 | ], 11 | "author": { 12 | "name": "Christiaan Bloemendaal", 13 | "email": "unity3d@tnrd.net", 14 | "url": "https://www.tnrd.net" 15 | }, 16 | "dependencies": {} 17 | } 18 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20b847ef848c14a41b4ee7d9d0c56f4b 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------