1- /* global CodeMirror, exec, join */
2-
31'use strict' ;
42
3+ /* global CodeMirror, exec, join */
4+
55require ( '../css/dword.css' ) ;
66
77const restafary = require ( 'restafary/client' ) ;
@@ -27,6 +27,7 @@ const _initSocket = require('./_init-socket');
2727
2828const notGlobal = ( name ) => ! window [ name ] ;
2929const addPrefix = currify ( ( obj , prefix , name ) => prefix + obj [ name ] ) ;
30+ const isString = ( a ) => typeof a === 'string' ;
3031
3132module . exports = Dword ;
3233
@@ -43,7 +44,7 @@ function Dword(el, options, callback) {
4344 if ( ! callback )
4445 callback = options ;
4546
46- if ( typeof el === 'string' )
47+ if ( isString ( el ) )
4748 el = document . querySelector ( el ) ;
4849
4950 this . _maxSize = options . maxSize || 512_000 ;
@@ -241,9 +242,11 @@ Dword.prototype.goToLine = function() {
241242 const coords = Ace . charCoords ( { line, ch} , 'local' ) ;
242243
243244 Ace . scrollTo ( null , ( coords . top + coords . bottom - myHeight ) / 2 ) ;
244- } ) . catch ( empty ) . then ( ( ) => {
245- dword . focus ( ) ;
246- } ) ;
245+ } )
246+ . catch ( empty )
247+ . then ( ( ) => {
248+ dword . focus ( ) ;
249+ } ) ;
247250
248251 return this ;
249252} ;
@@ -484,6 +487,7 @@ Dword.prototype._clipboard = _clipboard;
484487Dword . prototype . sha = function ( ) {
485488 const value = this . getValue ( ) ;
486489 const shaObj = new jssha ( 'SHA-1' , 'TEXT' ) ;
490+
487491 shaObj . update ( value ) ;
488492
489493 return shaObj . getHash ( 'HEX' ) ;
0 commit comments