1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 'use strict';
-
-
-
- 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;
- }
-
-
- var fields = line.split(':');
- return {
- username: fields[0],
- password: fields[1],
- uid: fields[2],
- gid: fields[3],
-
- gecos: fields[4],
- homedir: fields[5],
- shell: fields[6]
- };
- }
|