Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
saintedlama committed Sep 15, 2017
0 parents commit 2e01878
Show file tree
Hide file tree
Showing 16 changed files with 4,844 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .eslintrc
@@ -0,0 +1,12 @@
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"env": {
"es6": true,
"node": true,
"mocha": true
}
}
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
node_modules
.DS_Store
coverage/
.nyc_output/
*.*~
*.tgz
4 changes: 4 additions & 0 deletions .jsbeautifyrc
@@ -0,0 +1,4 @@
{
"indent_size": 2,
"brace_style": "collapse,preserve-inline"
}
22 changes: 22 additions & 0 deletions .travis.yml
@@ -0,0 +1,22 @@
language: node_js

sudo: false

node_js:
- "8"

env:
- MONGODB_VERSION="2.6.12"
- MONGODB_VERSION="3.0.15"
- MONGODB_VERSION="3.2.16"
- MONGODB_VERSION="3.4.7"

before_script:
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB_VERSION}.tgz -O /tmp/mongodb.tgz
- tar -xvf /tmp/mongodb.tgz
- mkdir /tmp/data
- ${PWD}/mongodb-linux-x86_64-${MONGODB_VERSION}/bin/mongod --dbpath /tmp/data &> /dev/null &
- ${PWD}/mongodb-linux-x86_64-${MONGODB_VERSION}/bin/mongod --version
- until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done

after_success: npm run coverage
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,46 @@
# 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, gender identity and expression, level of experience, 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 both within project spaces and in public spaces when an individual is representing the project or its community. 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 Christoph.Walcher@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems 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 [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
45 changes: 45 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,45 @@
# Contributing to Microq

:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

The following is a set of guidelines for contributing to microq.
These are just guidelines, not rules, use your best judgment and feel free to
propose changes to this document in a pull request.

This project adheres to the code of conduct https://github.com/saintedlama/microq/blob/master/CODE_OF_CONDUCT.md.
By participating, you are expected to uphold this code.

## Submitting Issues

* You can create an issue [here](https://github.com/saintedlama/microq/issues/new), but
before doing that please read the notes below on debugging and submitting issues,
and include as many details as possible with your report.
* Include the version of microq you are using.
* Include some source code snippet to demo the issue
* Include a stack trace and error message if applicable

## Pull Requests

* Run the tests before creating a pull requests (`npm test`).
* Include tests in the `test` directory.
* Update `README.md` if your pull request adds/changes functionality

## Git Commit Messages

* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Open database when..." not "Opens database when...")
* Limit the first line to 72 characters or less
* Reference issues and pull requests liberally
* Consider starting the commit message with an applicable emoji:
* :art: `:art:` when improving the format/structure of the code
* :racehorse: `:racehorse:` when improving performance
* :non-potable_water: `:non-potable_water:` when plugging memory leaks
* :memo: `:memo:` when writing docs
* :bug: `:bug:` when fixing a bug
* :fire: `:fire:` when removing code or files
* :green_heart: `:green_heart:` when fixing the CI build
* :white_check_mark: `:white_check_mark:` when adding tests
* :lock: `:lock:` when dealing with security
* :arrow_up: `:arrow_up:` when upgrading dependencies
* :arrow_down: `:arrow_down:` when downgrading dependencies
* :shirt: `:shirt:` when removing linter warnings
5 changes: 5 additions & 0 deletions LICENSE
@@ -0,0 +1,5 @@
Copyright (c) 2017, Christoph Walcher <christoph.walcher@gmail.com>

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
36 changes: 36 additions & 0 deletions index.js
@@ -0,0 +1,36 @@
const mongodb = require('mongodb');
const Database = require('./lib/database');

module.exports = function(connectionString, options) {
const db = new Database(connectionString, options);

return new Proxy(db, {
get: function(obj, prop) {
const dbProp = obj[prop];

if (dbProp) {
return dbProp;
}

return db.collection(prop);
}
});
}


// expose bson stuff visible in the shell
module.exports.Binary = mongodb.Binary
module.exports.Code = mongodb.Code
module.exports.DBRef = mongodb.DBRef
module.exports.Double = mongodb.Double
module.exports.Long = mongodb.Long
module.exports.NumberLong = mongodb.Long // Alias for shell compatibility
module.exports.MinKey = mongodb.MinKey
module.exports.MaxKey = mongodb.MaxKey
module.exports.ObjectID = mongodb.ObjectID
module.exports.ObjectId = mongodb.ObjectId
module.exports.Symbol = mongodb.Symbol
module.exports.Timestamp = mongodb.Timestamp

// Add support for default ES6 module imports
module.exports.default = module.exports

0 comments on commit 2e01878

Please sign in to comment.