git ssb

0+

jake / state-copy



Commit 89d0f847a7571ba612a52b8477dffe0dbebab2e4

initial commit

jake committed on 7/5/2017, 3:48:51 PM

Files changed

README.mdadded
index.jsadded
package-lock.jsonadded
package.jsonadded
README.mdView
@@ -1,0 +1,34 @@
1 +# state-copy
2 +
3 +> takes an object as input then serializes it as JSON and copies it to your clipboard
4 +
5 +Makes it easier to copy application state to your clipboard from the browser.
6 +
7 +## Usage
8 +
9 +```js
10 +var stateCopy = require('state-copy')
11 +
12 +stateCopy({wow: 'cool'})
13 +```
14 +
15 +what gets copied to clipboard
16 +
17 +```
18 +{"wow":"cool"}
19 +```
20 +
21 +## Install
22 +
23 +```
24 +$ npm install state-copy
25 +```
26 +
27 +## Acknowledgments
28 +
29 +state-copy was inspired by [@yoshuawuyts tweet](https://twitter.com/yoshuawuyts/status/882606862981615616)
30 +
31 +## License
32 +
33 +MIT
34 +
index.jsView
@@ -1,0 +1,16 @@
1 +var fastSafeStringify = require('fast-safe-stringify')
2 +var copy = require('copy-text-to-clipboard')
3 +
4 +function tryStringify (obj) {
5 + try {
6 + return JSON.stringify(obj)
7 + } catch (e) {}
8 +}
9 +
10 +function stateCopy (obj) {
11 + var str = tryStringify(obj) || fastSafeStringify(obj)
12 + copy(str)
13 +}
14 +
15 +module.exports = stateCopy
16 +
package-lock.jsonView
@@ -1,0 +1,17 @@
1 +{
2 + "name": "state-copy",
3 + "version": "1.0.0",
4 + "lockfileVersion": 1,
5 + "dependencies": {
6 + "copy-text-to-clipboard": {
7 + "version": "1.0.2",
8 + "resolved": "https://registry.npmjs.org/copy-text-to-clipboard/-/copy-text-to-clipboard-1.0.2.tgz",
9 + "integrity": "sha1-SAkoNmXyS0KGrL/Upn2LIJ6uFoA="
10 + },
11 + "fast-safe-stringify": {
12 + "version": "1.2.0",
13 + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-1.2.0.tgz",
14 + "integrity": "sha1-69QmZv0Y/k8rpPDSlQZfP4XK3pY="
15 + }
16 + }
17 +}
package.jsonView
@@ -1,0 +1,16 @@
1 +{
2 + "name": "state-copy",
3 + "version": "1.0.0",
4 + "description": "takes an object as input then serializes it as JSON and copies it to your clipboard",
5 + "main": "index.js",
6 + "author": " <jake @o91tsjBgL0l0zs475aRWYSAXFxvirZS7VrXmirY/msI=.ed25519>",
7 + "license": "MIT",
8 + "dependencies": {
9 + "copy-text-to-clipboard": "^1.0.2",
10 + "fast-safe-stringify": "^1.2.0"
11 + },
12 + "repository": {
13 + "type": "git",
14 + "url": "git+https://github.com/jekrb/state-copy.git"
15 + }
16 +}

Built with git-ssb-web