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

clipboard-parser

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clipboard-parser

A tool to read the clipboard and parse out the table data

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by25%
Maintainers
1
Weekly downloads
 
Created
Source

clipboard-parser

A tool to read the clipboard and parse out the table data. Support for parsing @RequestParam/@ApiModelProperty interfaces to define code, Word, Excel and other form-like data

NPM version Codacy Badge Test coverage npm download gzip License

Sonar

DocumentationChange Log

Installing

# use pnpm
$ pnpm install clipboard-parser

# use npm
$ npm install clipboard-parser --save

# use yarn
$ yarn add clipboard-parser

Usage

<!-- demo.vue -->
<template>
  <textarea @paste="handlePaste"></textarea>
</template>

<script>
import clipboardParser from 'clipboard-parser'

export default {
  methods: {
    handlePaste(e) {
      const result = clipboardParser(e)
      // ...
    }
  }
}
</script>

Using unpkg CDN:

<body>
  <textarea onpaste="handlePaste"></textarea>
</body>
<script src="https://unpkg.com/clipboard-parser@3.0.0/dist/index.global.prod.js"></script>
<script>
  function handlePaste(event) {
    const data = clipboardParser(event)
  }
</script>

Demos

1. Parsing JAVA code containing the interface definition of @RequestParam

input

@RequestParam("rowCount")
@ApiParam(required = false, name = "rowCount", value = "page size",defaultValue = 10)
    String rowCount,
@RequestParam(value = "current")
@ApiParam(required = false, name = "current", value = "start page",defaultValue = 1)
    String current,

output

[
  {
    "type": "String",
    "required": true,
    "name": "rowCount",
    "defaultValue": 10,
    "description": "page size"
  },
  {
    "type": "String",
    "required": true,
    "name": "current",
    "defaultValue": 1,
    "description": "start page"
  }
]

2. Parsing JAVA code containing the interface definition of @ApiModelProperty

input

@ApiModelProperty(value = "id key", required = true)
    private String id;
@ApiModelProperty(value = "name")
    private String name;

output

[
  {
    "required": true,
    "type": "String",
    "description": "id key",
    "defaultValue": "",
    "name": "id"
  },
  {
    "required": true,
    "type": "String",
    "description": "name",
    "defaultValue": "",
    "name": "name"
  }
]

3. Parse word/excel/web-page-table and other form-like data

input

ParametersDescriptionTypeOptionalRequiredDefault
typebranch typeStringfeature/bugfix/supportfalsecurrent branch type
namebranch nameString-falsecurrent branch name

output

[
  {
    "name": "type",
    "type": "String",
    "required": false,
    "defaultValue": "",
    "description": "branch type"
  },
  {
    "name": "name",
    "type": "String",
    "required": false,
    "defaultValue": "",
    "description": "branch name"
  }
]

Support & Issues

Please open an issue here.

License

MIT

Keywords

FAQs

Package last updated on 21 Jun 2023

Did you know?

Socket

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.

Install

Related posts

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