mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Extract duplicate utility functions and add unit tests (no-changelog) (#9814)
This commit is contained in:
committed by
GitHub
parent
283d1ca583
commit
e4463c62b4
@@ -9,7 +9,8 @@ import {
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { shuffleArray, sortByCode } from './utils';
|
||||
import { sortByCode } from './utils';
|
||||
import { shuffleArray } from '@utils/utilities';
|
||||
|
||||
export class Sort implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import { NodeVM } from '@n8n/vm2';
|
||||
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { NodeOperationError, randomInt } from 'n8n-workflow';
|
||||
|
||||
export const shuffleArray = (array: any[]) => {
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = randomInt(i + 1);
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
};
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
const returnRegExp = /\breturn\b/g;
|
||||
export function sortByCode(
|
||||
|
||||
Reference in New Issue
Block a user