File tree 2 files changed +11
-8
lines changed
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change
1
+ bin /bcrypt text eol =lf
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
2
3
3
var path = require ( "path" ) ,
4
- bcrypt = require ( path . join ( __dirname , '..' , ' index.js' ) ) ,
5
- pkg = require ( path . join ( __dirname , '..' , ' package.json' ) ) ;
4
+ bcrypt = require ( "../ index.js" ) ,
5
+ pkg = require ( "../ package.json" ) ;
6
6
7
7
if ( process . argv . length < 3 ) {
8
- process . stderr . write ( [ // No dependencies, so we do it from hand.
8
+ process . stderr . write ( [
9
9
"" ,
10
10
" |_ _ _ _ |_" ,
11
- " |_)(_| \\/|_)|_ v" + pkg [ 'version' ] + " (c) " + pkg [ 'author ' ] ,
11
+ " |_)(_| \\/|_)|_.js v" + pkg [ 'version ' ] ,
12
12
" / | "
13
- ] . join ( '\n' ) + '\n\n' + " Usage: " + path . basename ( process . argv [ 1 ] ) + " <input> [rounds|salt]\n" ) ;
13
+ ] . join ( '\n' ) + '\n\n' + " Usage: " + path . basename ( process . argv [ 1 ] ) + " <input> [rounds|salt]\n" ) ;
14
14
process . exit ( 1 ) ;
15
15
} else {
16
16
var salt ;
17
17
if ( process . argv . length > 3 ) {
18
18
salt = process . argv [ 3 ] ;
19
19
var rounds = parseInt ( salt , 10 ) ;
20
- if ( rounds == salt )
20
+ if ( rounds == salt ) {
21
21
salt = bcrypt . genSaltSync ( rounds ) ;
22
- } else
22
+ }
23
+ } else {
23
24
salt = bcrypt . genSaltSync ( ) ;
24
- process . stdout . write ( bcrypt . hashSync ( process . argv [ 2 ] , salt ) + "\n" ) ;
25
+ }
26
+ process . stdout . write ( bcrypt . hashSync ( process . argv [ 2 ] , salt ) + "\n" ) ;
25
27
}
You can’t perform that action at this time.
0 commit comments