Git Product home page Git Product logo

saqqdy / clipboard-parser Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 2.0 740 KB

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

License: MIT License

Shell 4.83% TypeScript 95.17%
java-parser parser clipboard-parser java-tool api-tool api java requestparam apimodelproperty word

clipboard-parser's Introduction

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

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/[email protected]/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

Parameters Description Type Optional Required Default
type branch type String feature/bugfix/support false current branch type
name branch name String - false current 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

clipboard-parser's People

Contributors

dependabot[bot] avatar saqqdy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

codhealer nckjxy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.