UNPKG

@itentialopensource/remove-duplicates-from-array-of-numbers-or-strings

Version:

[Deprecated] Removes duplicates from an array of numbers or an array of strings

175 lines 8.01 kB
{ "metadata": { "name": "@itentialopensource/remove-duplicates-from-array-of-numbers-or-strings", "version": "0.0.8-2023.1.1", "description": "[Deprecated] Removes duplicates from an array of numbers or an array of strings", "license": "Apache-2.0", "repository": { "type": "gitlab", "hostname": "gitlab.com", "path": "itentialopensource/pre-built-automations" }, "keywords": [ "Itential", "IAP", "artifacts", "Array", "String", "Integer", "Number", "Duplicates", "DEDUP", "Delete", "Remove", "Duplicate" ], "author": "Itential Artifacts", "IAPDependencies": {}, "gitlabId": 20171168 }, "manifest": { "bundleName": "Remove Duplicates From Array Of Numbers Or Strings", "fingerprint": "5f1e36cebe77670ab3c11268", "createdEpoch": "1595815630266", "artifacts": [ { "id": "5f1e1e7f655a0306dde634b2", "name": "removeDuplicates-NonObjects", "type": "transformation", "location": "/bundles/transformations/removeDuplicates-NonObjects.json", "properties": { "entryPoint": false } } ] }, "bundles": [ { "type": "transformation", "data": { "_id": "5f1e1e7f655a0306dde634b2", "name": "removeDuplicates-NonObjects", "incoming": [ { "$id": "array", "type": "array", "items": { "type": [ "boolean", "number", "integer", "string", "null" ] } } ], "outgoing": [ { "$id": "uniqueArray", "type": "array", "items": { "type": [ "boolean", "number", "integer", "string", "null" ] } } ], "steps": [ { "id": 2, "type": "assign", "from": { "location": "incoming", "name": "array", "ptr": "" }, "to": { "location": "declaration", "name": 1, "ptr": "/args/0/value" } }, { "id": 1, "type": "declaration", "library": "Set", "method": "new Set", "args": [ null ], "view": { "row": 1, "col": 1 }, "summary": "Converting to Set removes duplicates" }, { "id": 4, "type": "assign", "from": { "location": "declaration", "name": 1, "ptr": "/return" }, "to": { "location": "method", "name": 3, "ptr": "/args/0/value" } }, { "id": 3, "type": "method", "library": "Array", "method": "from", "args": [ null ], "view": { "row": 1, "col": 2 }, "summary": "Convert Set back to Array" }, { "id": 5, "type": "assign", "from": { "location": "method", "name": 3, "ptr": "/return" }, "to": { "location": "outgoing", "name": "uniqueArray", "ptr": "" } } ], "functions": [], "view": { "col": 2, "row": 5 }, "created": "2020-07-27T00:23:27.025Z", "createdBy": { "_id": "5e62a1e48b5a0506f10c3aa4", "provenance": "Itential LDAP", "username": "anto.oswin" }, "lastUpdated": "2020-07-27T00:23:27.025Z", "lastUpdatedBy": { "_id": "5e62a1e48b5a0506f10c3aa4", "provenance": "Itential LDAP", "username": "anto.oswin" } } } ], "readme": "<!-- This is a comment in md (Markdown) format, it will not be visible to the end user -->\n## _Deprecation Notice_\nThis Pre-Built has been deprecated as of 01-15-2024 and will be end of life on 01-15-2025. The capabilities of this Pre-Built have been replaced by the [IAP - Data Manipulation](https://gitlab.com/itentialopensource/pre-built-automations/iap-data-manipulation)\n\n# Remove Duplicates from Array of Numbers/Strings\n\n## Table of Contents\n\n* [Overview](#overview)\n* [Installation Prerequisites](#installation-prerequisites)\n* [How to Install](#how-to-install)\n* [How to Run](#how-to-run)\n* [Attributes](#attributes)\n* [Examples](#examples)\n* [Additional Information](#additional-information)\n\n## Overview\n\nThis JST allows IAP users to remove duplicates from an array of numbers or an array of strings. The JST uses the standard built in JavaScript object [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) to remove duplicates. The resulting array will preserve only the first occurrences of each element from the original array.\nFor performance purposes, please note that the worst-case time complexity for this JST is $`O(n)`$.\n\n## Installation Prerequisites\nUsers must satisfy the following prerequisites:\n* Itential Automation Platform: `^2023.1`\n\n## How to Install\n\nTo install the pre-built:\n* Verify you are running a supported version of the Itential Automation Platform (IAP) as listed above in the [Prerequisites](#installation-prerequisites) section.\n* The pre-build can be installed from within `App-Admin_Essential`. Simply search for the name of your desired pre-build and click the install button.\n\n## How to Run\n\nUse the following to run the pre-build:\n1. Once the JST is installed as outlined in the [How to Install](#how-to-install) section above, navigate to the workflow where you would like to remove duplicates from an array and add a `JSON Transformation` task.\n\n2. Inside the `Transformation` task, search for and select `removeDuplicates-NonObjects` (the name of the internal JST).\n\n3. The inputs to the JST would be the array from which the duplicates have to be removed.\n\n4. Save your input and the task is ready to run inside of IAP.\n\n## Attributes \n\nAttributes for the pre-build are outlined in the following tables.\n\n**Input**\n<table border='1' style='border-collapse:collapse'>\n<thead>\n<tr>\n<th>Attribute</th>\n<th>Description</th>\n<th>Type</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>array</code></td>\n<td>an array of numbers or an array of strings (array of booleans or nulls also supported)</td>\n<td><code>array[numbers/integers/strings/booleans/nulls]</code></td>\n</tr>\n</tbody>\n</table>\n\n\n**Output**\n<table border='1' style='border-collapse:collapse'>\n<thead>\n<tr>\n<th>Attribute</th>\n<th>Description</th>\n<th>Type</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>uniqueArray</code></td>\n<td>array without duplicate elements</td>\n<td><code>array[numbers/integers/strings/booleans/nulls]</code></td>\n</tr>\n</tbody>\n</table>\n\n## Examples\n\n### Example 1\n***Input Array***\n```\n[\n 9,\n 8,\n 7.45,\n 77,\n 7,\n 7,\n 8,\n 9\n]\n ```\n\n***Output Array***\n```\n[\n 9,\n 8,\n 7.45,\n 77,\n 7\n]\n ```\n \n### Example 2\n***Input Array***\n```\n[\n \"hello\",\n \"world\",\n \"hello\",\n null,\n true,\n true,\n null,\n \"world\",\n \"HeLLo\"\n ]\n ```\n\n ***Output Array***\n```\n[\n \"hello\",\n \"world\",\n null,\n true,\n \"HeLLo\"\n]\n ```\n \n## Additional Information\nPlease use your Itential Customer Succcess account if you need support when using this Pre-Built Transformation.\n" }