Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clippie

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clippie - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

24

index.js
export async function clippie(content) {
try {
for (const c of Array.isArray(content) ? content : [content]) {
if (c instanceof Blob) {
const item = new ClipboardItem({[c.type]: c});
await navigator.clipboard.write([item]);
} else {
try {
await navigator.clipboard.writeText(c);
} catch {
return fallback(c);
}
for (const c of Array.isArray(content) ? content : [content]) {
if (c instanceof Blob) {
const item = new ClipboardItem({[c.type]: c});
await navigator.clipboard.write([item]);
} else {
try {
await navigator.clipboard.writeText(c);
} catch {
return fallback(c);
}
}
return true;
} catch {
return false;
}
return true;
}

@@ -20,0 +16,0 @@

{
"name": "clippie",
"version": "2.1.0",
"version": "3.0.0",
"description": "Teeny-tiny browser clipboard copy",

@@ -15,9 +15,9 @@ "author": "silverwind",

"devDependencies": {
"eslint": "8.28.0",
"eslint-config-silverwind": "63.0.0",
"eslint": "8.29.0",
"eslint-config-silverwind": "65.0.0",
"jsdom": "20.0.3",
"updates": "13.2.1",
"versions": "10.2.4",
"vitest": "0.25.3"
"updates": "13.2.4",
"versions": "10.4.1",
"vitest": "0.25.8"
}
}

@@ -11,7 +11,8 @@ # clippie

// copy text
const success = await clippie("text to copy");
// copy image
const success = await clippie(imageBlob);
let success;
try {
success = await clippie(stringOrBlob);
} catch {
success = false;
}
```

@@ -24,4 +25,8 @@

Returns `true` when successful and `false` when not. Will never throw.
Returns a boolean indicating success. May throw critical errors.
## Notes
To enable image copy in Firefox, enable `dom.events.asyncClipboard.clipboardItem` in `about:config`. Track [Bug 1619947](https://bugzilla.mozilla.org/show_bug.cgi?id=1619947) for updates.
© [silverwind](https://github.com/silverwind), distributed under BSD licence
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc