This repository was archived by the owner on Nov 28, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change 8
8
9
9
; ( function ( global , factory ) {
10
10
'use strict' ;
11
+
12
+ let Peb = factory ( global )
13
+
11
14
if ( global . module ) {
12
- moudule . export = factory ( global ) ;
15
+ // Node.js
16
+ moudule . export = Peb ;
13
17
} else if ( global . window ) {
14
- window . peb = factory ( global ) ;
18
+ // Browser
19
+ window . peb = Peb ;
20
+ }
21
+
22
+ // AMD
23
+ if ( typeof define === 'function' && define . amd ) {
24
+ define ( "peb" , [ ] , function ( ) {
25
+ return Peb ;
26
+ } ) ;
15
27
}
16
28
} ) ( this , function ( window ) {
17
29
'use strict' ;
482
494
/**
483
495
* Return a boolean of is obj a number
484
496
* Contains `123` `"123"` `1.23` `"1.23"` `.23` `".23"`
485
- * @param {any } obj
497
+ * @param {string | number } obj
486
498
*/
487
499
peb . isdigit = function ( obj ) {
488
500
return ! isNaN ( obj )
489
501
}
490
502
491
503
/**
492
- * Sleep time but `await` required
504
+ * Sleep time
505
+ * `peb.sleep(time).then(Fn)` = setTimeOut
506
+ * `await sleep(time)` is normal sleep time
493
507
* @param {number } time
494
508
*/
495
509
peb . sleep = async function ( time ) {
496
510
return new Promise ( resolve => {
497
- setTimeout ( ( ) => resolve ( ) , time ) ;
511
+ setTimeout ( resolve , time ) ;
498
512
} ) ;
499
513
}
500
514
You can’t perform that action at this time.
0 commit comments