Skip to content

Commit

Permalink
Initialize project
Browse files Browse the repository at this point in the history
  • Loading branch information
piecioshka committed May 10, 2019
0 parents commit 41e6a70
Show file tree
Hide file tree
Showing 14 changed files with 2,371 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
87 changes: 87 additions & 0 deletions .gitignore
@@ -0,0 +1,87 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
13 changes: 13 additions & 0 deletions .travis.yml
@@ -0,0 +1,13 @@
language: node_js
os:
- linux
- osx
- windows
node_js:
- "12"
- "11"
- "10"
- "9"
- "8"
after_script:
- npm run coverage
77 changes: 77 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,77 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at piecioshka@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 Piotr Kowalski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

59 changes: 59 additions & 0 deletions README.md
@@ -0,0 +1,59 @@
# find-google-docs-in-string

[![npm version](https://badge.fury.io/js/find-google-docs-in-string.svg)](https://badge.fury.io/js/find-google-docs-in-string)
[![downloads count](https://img.shields.io/npm/dt/find-google-docs-in-string.svg)](https://www.npmjs.com/~piecioshka)
[![dependencies](https://david-dm.org/piecioshka/find-google-docs-in-string.svg)](https://github.com/piecioshka/find-google-docs-in-string)
[![travis](https://img.shields.io/travis/piecioshka/find-google-docs-in-string.svg)](https://travis-ci.org/piecioshka/find-google-docs-in-string)
[![coveralls](https://coveralls.io/repos/github/piecioshka/find-google-docs-in-string/badge.svg?branch=master)](https://coveralls.io/github/piecioshka/find-google-docs-in-string?branch=master)
[![snyk](https://snyk.io/test/github/piecioshka/find-google-docs-in-string/badge.svg?targetFile=package.json)](https://snyk.io/test/github/piecioshka/find-google-docs-in-string?targetFile=package.json)

:hammer: Find links from **Google Docs** in string or file

## Installation

```bash
npm install -g find-google-docs-in-string
```

## Usage

```javascript
const findGoogleDocs = require('find-google-docs-in-string');
const links = findGoogleDocs(
`
<https://docs.google.com/document/d/super-uniq-id/edit>
https://docs.google.com/document/d/super-uniq-id-2/edit
https://google.com/search?q=cookie
`
);

console.log(links);
// - https://docs.google.com/document/d/super-uniq-id/edit
// - https://docs.google.com/document/d/super-uniq-id-2/edit
```

## CLI

```bash
find-google-docs-in-string /path/to/text/file
```

## Unit tests

```bash
npm test
```

## Code coverage

```bash
npm run coverage
```

## Related

* [find-emails-in-string-cli](https://github.com/piecioshka/find-emails-in-string-cli)

## License

[The MIT License](http://piecioshka.mit-license.org) @ 2019
34 changes: 34 additions & 0 deletions bin/cli.js
@@ -0,0 +1,34 @@
#!/usr/bin/env node

const fs = require('fs');
const util = require('util');
const readfile = util.promisify(fs.readFile);

const yargs = require('yargs');
const pkg = require('../package.json');
const finder = require('../src').find;
const formatter = require('../src/formatters/list').format;

const argv = yargs
.usage(`${pkg.description}\n\n $ $0 /path/to/text/file`)
.argv;

const filename = String(argv._).trim();

(async () => {
if (!filename) {
yargs.showHelp();
return;
}

try {
const contentBuffer = await readfile(filename);
const content = contentBuffer.toString('utf-8');

const links = finder(content);
const result = formatter(links);
console.log(result);
} catch (err) {
console.error(err.message);
}
})();
1 change: 1 addition & 0 deletions index.js
@@ -0,0 +1 @@
module.exports = require('./src');

0 comments on commit 41e6a70

Please sign in to comment.