
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
verify-array-sort
Advanced tools
A package to verify if the array is sorted in ascending or descending order
This Node.js package provides a function to check if an array is sorted in ascending or descending order.
npm install verify-array-sort
const isSorted = require('verify-array-sort');
import isSorted from 'verify-array-sort'
// Check if an array of numbers is sorted in ascending order
const numbers = [1, 2, 3, 4, 5];
console.log(isSorted(numbers, 'ascending')); // Output: true
// Check if an array of numbers is sorted in descending order
const numbersDesc = [5, 4, 3, 2, 1];
console.log(isSorted(numbersDesc, 'descending')); // Output: true
// Check if an array of strings is sorted in ascending order (lexicographically)
const strings = ['apple', 'banana', 'cherry'];
console.log(isSorted(strings, 'ascending')); // Output: true
// Check if an array of dates is sorted in ascending order
const dates = [new Date('2023-01-01'), new Date('2023-02-01'), new Date('2023-03-01')];
console.log(isSorted(dates, 'ascending')); // Output: true
// Example with unsorted array
const unsortedNumbers = [1, 3, 2, 4];
console.log(isSorted(unsortedNumbers, 'ascending')); // Output: false
isSorted(arr, order)
Returns:
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A package to verify if the array is sorted in ascending or descending order
We found that verify-array-sort demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.