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

@react-hook/copy

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-hook/copy - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

dist/esm/index.mjs

135

package.json
{
"name": "@react-hook/copy",
"version": "1.0.1",
"main": "dist/cjs/index.js",
"module": "dist/es/index.js",
"author": "Jared Lunde <jared@BeStellar.co> (https://BeStellar.co)",
"version": "2.0.0",
"homepage": "https://github.com/jaredLunde/react-hook#readme",
"repository": "github:jaredLunde/react-hook",
"bugs": "https://github.com/jaredLunde/react-hook/issues",
"author": "Jared Lunde <jared.lunde@gmail.com> (https://jaredLunde.com)",
"license": "MIT",
"sideEffects": false,
"repository": "https://github.com/jaredLunde/react-hook/tree/master/packages/copy",
"scripts": {
"build": "yarn run build:es && yarn run build:cjs",
"build:es": "rimraf dist/es && cross-env NODE_ENV=production BABEL_ENV=es babel src --out-dir dist/es && npm run prettier:es",
"build:cjs": "rimraf dist/cjs && cross-env NODE_ENV=production BABEL_ENV=cjs babel src --out-dir dist/cjs && npm run prettier:cjs",
"watch:es": "rimraf dist/es && cross-env NODE_ENV=production BABEL_ENV=es babel src -w --out-dir dist/es",
"prettier": "prettier --single-quote --no-semi --no-bracket-spacing --trailing-comma es5 --write",
"prettier:es": "yarn prettier \"dist/es/**/*.js\"",
"prettier:cjs": "yarn prettier \"dist/cjs/**/*.js\"",
"prepublishOnly": "yarn build"
},
"description": "A React hook for copying text to the clipboard",
"keywords": [

@@ -29,11 +19,114 @@ "react",

],
"main": "dist/main/index.js",
"module": "dist/module/index.js",
"unpkg": "dist/umd/use-copy.js",
"source": "src/index.tsx",
"types": "types/index.d.ts",
"files": [
"/dist",
"/src",
"/types"
],
"exports": {
".": {
"browser": "./dist/module/index.js",
"import": "./dist/esm/index.mjs",
"require": "./dist/main/index.js",
"umd": "./dist/umd/use-copy.js",
"source": "./src/index.tsx",
"types": "./types/index.d.ts",
"default": "./dist/main/index.js"
},
"./package.json": "./package.json",
"./": "./"
},
"sideEffects": false,
"scripts": {
"build": "lundle build --umd-case camel",
"check-types": "lundle check-types",
"dev": "lundle build -f module,cjs -w",
"format": "prettier --write \"{,!(node_modules|dist|coverage)/**/}*.{ts,tsx,js,jsx,md,yml,json}\"",
"lint": "eslint . --ext .ts,.tsx",
"prepublishOnly": "npm run lint && npm run test && npm run build && npm run format",
"test": "jest",
"validate": "lundle check-types && npm run lint && jest --coverage"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"**/*.{ts,tsx,js,jsx}": [
"lundle build -f types",
"eslint",
"prettier --write"
],
"**/*.{md,yml,json}": [
"prettier --write"
]
},
"eslintConfig": {
"extends": [
"lunde"
]
},
"eslintIgnore": [
"node_modules",
"coverage",
"dist",
"test",
"*.config.js"
],
"jest": {
"moduleDirectories": [
"node_modules",
"src",
"test"
],
"testMatch": [
"<rootDir>/src/**/?(*.)test.{ts,tsx}"
],
"collectCoverageFrom": [
"**/src/**/*.{ts,tsx}"
],
"setupFilesAfterEnv": [
"./test/setup.js"
],
"snapshotResolver": "./test/resolve-snapshot.js",
"globals": {
"__DEV__": true
}
},
"prettier": {
"semi": false,
"singleQuote": true,
"jsxSingleQuote": true,
"bracketSpacing": false
},
"devDependencies": {
"@stellar-apps/babel-preset-es": "^1.0.4",
"@stellar-apps/babel-preset-react": "^1.0.1",
"prettier": "^1.16.4",
"rimraf": "^2.6.3"
"@testing-library/jest-dom": "latest",
"@testing-library/react": "latest",
"@testing-library/react-hooks": "latest",
"@testing-library/user-event": "latest",
"@types/jest": "latest",
"@types/react": "latest",
"@types/react-dom": "latest",
"babel-jest": "latest",
"eslint": "latest",
"eslint-config-lunde": "latest",
"husky": "latest",
"jest": "latest",
"lint-staged": "latest",
"lundle": "latest",
"prettier": "latest",
"react": "latest",
"react-dom": "latest",
"react-test-renderer": "latest",
"typescript": "latest"
},
"dependencies": {},
"peerDependencies": {
"react": "^16.8.0"
"react": ">=16.8"
}
}

@@ -1,19 +0,62 @@

# @react-hook/copy
<hr>
<div align="center">
<h1 align="center">
useCopy()
</h1>
</div>
<p align="center">
<a href="https://bundlephobia.com/result?p=@react-hook/copy">
<img alt="Bundlephobia" src="https://img.shields.io/bundlephobia/minzip/@react-hook/copy?style=for-the-badge&labelColor=24292e">
</a>
<a aria-label="Types" href="https://www.npmjs.com/package/@react-hook/copy">
<img alt="Types" src="https://img.shields.io/npm/types/@react-hook/copy?style=for-the-badge&labelColor=24292e">
</a>
<!--
<a aria-label="Code coverage report" href="https://codecov.io/gh/jaredLunde/react-hook">
<img alt="Code coverage" src="https://img.shields.io/codecov/c/gh/jaredLunde/react-hook?style=for-the-badge&labelColor=24292e">
</a>
<a aria-label="Build status" href="https://travis-ci.com/jaredLunde/react-hook">
<img alt="Build status" src="https://img.shields.io/travis/com/jaredLunde/react-hook?style=for-the-badge&labelColor=24292e">
</a>
-->
<a aria-label="NPM version" href="https://www.npmjs.com/package/@react-hook/copy">
<img alt="NPM Version" src="https://img.shields.io/npm/v/@react-hook/copy?style=for-the-badge&labelColor=24292e">
</a>
<a aria-label="License" href="https://jaredlunde.mit-license.org/">
<img alt="MIT License" src="https://img.shields.io/npm/l/@react-hook/copy?style=for-the-badge&labelColor=24292e">
</a>
</p>
<pre align="center">npm i @react-hook/copy</pre>
<hr>
A React hook for copying text to the clipboard
## Installation
`yarn add @react-hook/copy`
## Quick Start
## Usage
```jsx harmony
import useCopy from '@react-hook/copy'
const F = props => {
const [copied, copy] = useCopy('This text will be copied to the clipboard')
return (
<a onClick={copy}>
{copied === false ? 'Copy' : 'Copied'}
</a>
const Component = (props) => {
const {copied, copy, reset} = useCopy(
'This text will be copied to the clipboard'
)
return <a onClick={copy}>{copied === false ? 'Copy' : 'Copied'}</a>
}
```
```
## API
### useCopy(text: string)
| Argument | Type | Required? | Description |
| -------- | -------- | --------- | ----------------------------------------------------------------- |
| text | `string` | Yes | The text you want to copy to the clipboard when `copy` is clicked |
### Returns `{copied: boolean, copy: () => void, reset: () => void}`
## LICENSE
MIT
dist/cjs/index.js

Sorry, the diff of this file is not supported yet

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