
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.
Simple and fast TypeScript in-memory caching. Modern TypeScript port of node-cache.

A high-performance, type-safe deep cloning utility for TypeScript and JavaScript applications.
# Using npm
npm install ts-clone
# Using yarn
yarn add ts-clone
# Using pnpm
pnpm add ts-clone
# Using bun
bun add ts-clone
import { clone } from 'ts-clone'
// Simple cloning
const original = { name: 'John', roles: ['admin', 'user'] }
const cloned = clone(original)
// Handles circular references
const circular = { prop: 'value' }
circular.self = circular
const clonedCircular = clone(circular) // Works without infinite loops
// Clone with specified depth
const nested = { level1: { level2: { level3: 'deep' } } }
const shallow = clone(nested, true, 1) // Only clones the first level
// Clone with options object
const obj = { hidden: 'property' }
Object.defineProperty(obj, 'hidden', { enumerable: false })
const withNonEnumerable = clone(obj, {
includeNonEnumerable: true
})
// Clone RegExp objects with their flags and lastIndex
const regex = /pattern/gi
regex.lastIndex = 5
const clonedRegex = clone(regex)
console.log(clonedRegex.source) // 'pattern'
console.log(clonedRegex.flags) // 'gi'
console.log(clonedRegex.lastIndex) // 5
// Clone ES6+ objects
const map = new Map([['key', 'value']])
const set = new Set(['item1', 'item2'])
const promise = Promise.resolve('data')
const clonedMap = clone(map)
const clonedSet = clone(set)
const clonedPromise = clone(promise)
// Clone with prototype handling
const proto = { shared: 'value' }
const instance = Object.create(proto)
instance.own = 'property'
// Clone with original prototype
const clonedWithProto = clone(instance)
console.log(clonedWithProto.shared) // 'value'
// Clone with custom prototype
const clonedCustomProto = clone(instance, true, Infinity, {})
console.log(clonedCustomProto.shared) // undefined
// Clone just the prototype
const proto = {
method() {
return 'result'
}
}
const protoClone = clone.clonePrototype(proto)
// Type checking utilities
clone.__isArray([1, 2, 3]) // true
clone.__isDate(new Date()) // true
clone.__isRegExp(/pattern/) // true
// RegExp flags extraction
clone.__getRegExpFlags(/pattern/gi) // 'gim'
Please see the Contributing Guide for details.
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
For casual chit-chat with others using this package:
Join the Stacks Discord Server
“Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
clone module for the initial implementation inspirationThe MIT License (MIT). Please see LICENSE for more information.
Made with 💙
FAQs
Simple and fast TypeScript in-memory caching. Modern TypeScript port of node-cache.
We found that ts-clone 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
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.