
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@aldoivan10/linked-array
Advanced tools
LinkedArray es una extensión de la clase Array en TypeScript que proporciona funcionalidades avanzadas como mover, intercambiar, obtener elementos por índices negativos (similar a Python), y mucho más. Funciona como un array estándar de JavaScript, por lo que puedes usar todas sus funciones nativas junto con las nuevas capacidades.
move, swap, first, last, entre otras.Puedes instalar esta librería usando npm:
npm install @aldoivan/linked-array
pnpm add @aldoivan/linked-array
import { LinkedArray } from "@aldoivan10/linked-array"
const array = new LinkedArray(1, 2, 3, 4, 5)
console.log(array[0]) // 1
console.log(array.first()) // 1
console.log(array.last()) // 5
console.log(array[-2], array.index()) // 4 0 pero no mueve el índice interno
console.log(array.at(-1), array.index()) // 5 4
array.move(0, 2)
console.log(array) // [2, 3, 1, 4, 5]
array.swap(0, 1)
console.log(array) // [3, 2, 1, 4, 5]
console.log(array.next()) // 3
console.log(array.previous()) // 5
console.log(array.current()) // 5
const objArr = new LinkedArray({ name: "Aldo" })
const clone = objArr.clone()
clone[0].name = "Ivan"
console.log(objArr, clone) // [{ name: "Aldo" }] [{ name: "Ivan" }]
objArr.push({ name: "Lau" })
console.log(objArr) // [{ name: "Aldo" }, { name: "Lau" }]
import { LinkedArray } from "@aldoivan10/linked-array"
const numArray = new LinkedArray(5, 3, 8, 1, 9)
const sortedNumArrayAsc = numArray.sorted() // numArray.sorted({ order: "asc" })
console.log(sortedNumArrayAsc) // [1, 3, 5, 8, 9]
const sortedNumArrayDesc = numArray.sorted({ order: "desc" })
console.log(sortedNumArrayDesc) // [9, 8, 5, 3, 1]
interface Person {
name: string
age: number
address: {
city: string
zip: number
}
}
const people = new LinkedArray<Person>(
{ name: "Alice", age: 30, address: { city: "New York", zip: 10001 } },
{ name: "Bob", age: 25, address: { city: "Los Angeles", zip: 90001 } },
{ name: "Charlie", age: 35, address: { city: "Chicago", zip: 60601 } }
)
const sortedPeopleByAgeAsc = people.sorted({ attr: "age" }) // order = 'asc'
console.log(sortedPeopleByAgeAsc)
// [
// { name: 'Bob', age: 25, address: { city: 'Los Angeles', zip: 90001 } },
// { name: 'Alice', age: 30, address: { city: 'New York', zip: 10001 } },
// { name: 'Charlie', age: 35, address: { city: 'Chicago', zip: 60601 } }
// ]
const sortedPeopleByCityAsc = people.sorted({
order: "desc",
attr: "address.city",
})
console.log(sortedPeopleByCityAsc)
// [
// { name: 'Alice', age: 30, address: { city: 'New York', zip: 10001 } },
// { name: 'Bob', age: 25, address: { city: 'Los Angeles', zip: 90001 } },
// { name: 'Charlie', age: 35, address: { city: 'Chicago', zip: 60601 } },
// ]
clean(): Limpia el array.replace(array: Array<T>, index?: number): Reemplaza el contenido del array e inicializa el índice interno.first(): Retorna el primer elemento del array.last(): Retorna el último elemento del array.current(): Retorna el elemento actual según el índice interno.move(fromIndex: number, toIndex: number): Mueve un elemento a una nueva posición.swap(index1: number, index2: number): Intercambia dos elementos.next(): Retorna el siguiente elemento (con índice circular).previous(): Retorna el elemento anterior (con índice circular).index(): Retorna el índice interno actual.at(index: number): Retorna el elemento en una posición específica.clone(): Clona el array (incluidos los objetos internos).removeAt(index: number): Elimina un elemento en una posición dada.sorted({ order?: 'asc' | 'desc' = 'asc', attr?: string }?): Ordena el array según los parámetros.Este proyecto está licenciado bajo la Licencia MIT.
FAQs
Class to linked array in javascript
We found that @aldoivan10/linked-array demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.