View array.util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable security/detect-object-injection */ | |
import { flattenDeep, uniq } from 'lodash'; | |
import { BooleanDictionary } from '../definitions'; | |
/** | |
* Takes in a string and converts it to an array of strings | |
* @param values String with comma separated values | |
* @param removeSpaces Whether to remove spaces from the values | |
* @param toLower Whether to convert the values to lowercase | |
* @param separator The separator to use for splitting the string |
View export-utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function exportToJson(data: unknown, fileName: string, directory: string) { | |
this.logger.debug({ msg: 'file name', fileName }); | |
const jsonData = JSON.stringify(data); | |
const filePath = join(directory, `${new Date().toISOString()}_${fileName}.json`); | |
writeFile(filePath, jsonData, (err) => { | |
if (err) { | |
this.logger.error({ | |
msg: `An error occurred while writing JSON to File.`, | |
filePath, | |
err, |
View array.util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Takes in a string and converts it to an array of strings | |
* @param values String with comma separated values | |
* @returns array of strings or undefined | |
*/ | |
export function splitStringAndCleanArray(values?: string, removeSpaces = false): string[] | undefined { | |
const cleaned = | |
values?.split(',')?.map((v) => { | |
const mod = v?.trim(); | |
return removeSpaces ? mod.replace(' ', '') : mod; |
View test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
filePath=$1 | |
testGroup=$2 | |
clearCache=$3 | |
if [[ $clearCache == true ]]; then | |
echo "Clearing cache" | |
node "/<path>/node_modules/jest/bin/jest.js" --clearCache --verbose | |
fi |
View streams.get.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { pipeline, Transform, TransformCallback } from 'stream'; | |
import { promisify } from 'util'; | |
import { env } from 'process'; | |
import axios, { | |
AxiosInstance, | |
AxiosRequestConfig, | |
AxiosResponse, | |
ResponseType, | |
} from 'axios'; | |
import * as JSONStream from 'jsonstream-next'; |
View array.util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Merge two distinct arrays into a single, unique record | |
* @param originalArray Starting version of the array | |
* @param newArray New values to append to the array | |
* @returns A unique array of values | |
*/ | |
export function mergeArrays<T>(originalArray?: T[], newArray?: T[]) { | |
return ( | |
(Array.isArray(originalArray) | |
? [...new Set([...originalArray, ...(newArray ?? [])])]?.filter((v) => typeof v !== 'undefined') |
View console_angular_var_update.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $scope = angular.element($0).scope(); | |
$scope.$apply(function () { | |
// SET VARIABLE HERE | |
}); |