added unit testing, and started implementing unit tests...phew
This commit is contained in:
21
node_modules/parse-passwd/LICENSE
generated
vendored
Normal file
21
node_modules/parse-passwd/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Brian Woodward
|
||||
|
||||
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.
|
86
node_modules/parse-passwd/README.md
generated
vendored
Normal file
86
node_modules/parse-passwd/README.md
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
# parse-passwd [](https://www.npmjs.com/package/parse-passwd) [](https://npmjs.org/package/parse-passwd) [](https://travis-ci.org/doowb/parse-passwd) [](https://ci.appveyor.com/project/doowb/parse-passwd)
|
||||
|
||||
> Parse a passwd file into a list of users.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save parse-passwd
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var parse = require('parse-passwd');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
// assuming '/etc/passwd' contains:
|
||||
// doowb:*:123:123:Brian Woodward:/Users/doowb:/bin/bash
|
||||
console.log(parse(fs.readFileSync('/etc/passwd', 'utf8')));
|
||||
|
||||
//=> [
|
||||
//=> {
|
||||
//=> username: 'doowb',
|
||||
//=> password: '*',
|
||||
//=> uid: '123',
|
||||
//=> gid: '123',
|
||||
//=> gecos: 'Brian Woodward',
|
||||
//=> homedir: '/Users/doowb',
|
||||
//=> shell: '/bin/bash'
|
||||
//=> }
|
||||
//=> ]
|
||||
```
|
||||
|
||||
**Params**
|
||||
|
||||
* `content` **{String}**: Content of a passwd file to parse.
|
||||
* `returns` **{Array}**: Array of user objects parsed from the content.
|
||||
|
||||
## About
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
Please read the [contributing guide](contributing.md) for avice on opening issues, pull requests, and coding standards.
|
||||
|
||||
### Building docs
|
||||
|
||||
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
|
||||
|
||||
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
|
||||
|
||||
```sh
|
||||
$ npm install -g verb verb-generate-readme && verb
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm install -d && npm test
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
**Brian Woodward**
|
||||
|
||||
* [github/doowb](https://github.com/doowb)
|
||||
* [twitter/doowb](http://twitter.com/doowb)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2016, [Brian Woodward](https://github.com/doowb).
|
||||
Released under the [MIT license](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 19, 2016._
|
56
node_modules/parse-passwd/index.js
generated
vendored
Normal file
56
node_modules/parse-passwd/index.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Parse the content of a passwd file into a list of user objects.
|
||||
* This function ignores blank lines and comments.
|
||||
*
|
||||
* ```js
|
||||
* // assuming '/etc/passwd' contains:
|
||||
* // doowb:*:123:123:Brian Woodward:/Users/doowb:/bin/bash
|
||||
* console.log(parse(fs.readFileSync('/etc/passwd', 'utf8')));
|
||||
*
|
||||
* //=> [
|
||||
* //=> {
|
||||
* //=> username: 'doowb',
|
||||
* //=> password: '*',
|
||||
* //=> uid: '123',
|
||||
* //=> gid: '123',
|
||||
* //=> gecos: 'Brian Woodward',
|
||||
* //=> homedir: '/Users/doowb',
|
||||
* //=> shell: '/bin/bash'
|
||||
* //=> }
|
||||
* //=> ]
|
||||
* ```
|
||||
* @param {String} `content` Content of a passwd file to parse.
|
||||
* @return {Array} Array of user objects parsed from the content.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(content) {
|
||||
if (typeof content !== 'string') {
|
||||
throw new Error('expected a string');
|
||||
}
|
||||
return content
|
||||
.split('\n')
|
||||
.map(user)
|
||||
.filter(Boolean);
|
||||
};
|
||||
|
||||
function user(line, i) {
|
||||
if (!line || !line.length || line.charAt(0) === '#') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// see https://en.wikipedia.org/wiki/Passwd for field descriptions
|
||||
var fields = line.split(':');
|
||||
return {
|
||||
username: fields[0],
|
||||
password: fields[1],
|
||||
uid: fields[2],
|
||||
gid: fields[3],
|
||||
// see https://en.wikipedia.org/wiki/Gecos_field for GECOS field descriptions
|
||||
gecos: fields[4],
|
||||
homedir: fields[5],
|
||||
shell: fields[6]
|
||||
};
|
||||
}
|
86
node_modules/parse-passwd/package.json
generated
vendored
Normal file
86
node_modules/parse-passwd/package.json
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"_from": "parse-passwd@^1.0.0",
|
||||
"_id": "parse-passwd@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=",
|
||||
"_location": "/parse-passwd",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "parse-passwd@^1.0.0",
|
||||
"name": "parse-passwd",
|
||||
"escapedName": "parse-passwd",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/homedir-polyfill"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz",
|
||||
"_shasum": "6d5b934a456993b23d37f40a382d6f1666a8e5c6",
|
||||
"_spec": "parse-passwd@^1.0.0",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/homedir-polyfill",
|
||||
"author": {
|
||||
"name": "Brian Woodward",
|
||||
"url": "https://github.com/doowb"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/doowb/parse-passwd/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Parse a passwd file into a list of users.",
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^0.1.11",
|
||||
"mocha": "^3.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"LICENSE"
|
||||
],
|
||||
"homepage": "https://github.com/doowb/parse-passwd",
|
||||
"keywords": [
|
||||
"etc",
|
||||
"etc-passwd",
|
||||
"etc/passwd",
|
||||
"parse",
|
||||
"parse-passwd",
|
||||
"passwd"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "parse-passwd",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/doowb/parse-passwd.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
},
|
||||
"related": {
|
||||
"list": []
|
||||
},
|
||||
"reflinks": [
|
||||
"verb",
|
||||
"verb-generate-readme"
|
||||
]
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
Reference in New Issue
Block a user