Skip to content

Commit

Permalink
fix bin/random; + 1.0.0-beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
nuysoft committed Dec 14, 2015
1 parent 9606d33 commit a591ea1
Show file tree
Hide file tree
Showing 6 changed files with 770 additions and 756 deletions.
11 changes: 10 additions & 1 deletion bin/random
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ program
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m
var FN_ARG_SPLIT = /,/
var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg
var EXCLUDE = [
'extend',
'dataImage', // mock/random/image
'capitalize', 'upper', 'lower', 'pick', 'shuffle', 'order', // mock/random/helper.js
'increment', 'inc' // mock/random/misc.js
]

function parseArgs(fn) {
var fnText = fn.toString().replace(STRIP_COMMENTS, '')
Expand All @@ -40,6 +46,9 @@ program
}

Object.keys(Random).forEach(function(key) {
if (key[0] === '_') return
if (EXCLUDE.indexOf(key) !== -1) return

var fn = Random[key]
if (typeof fn === 'function') {
var argDecl = parseArgs(fn)
Expand Down
13 changes: 9 additions & 4 deletions dist/mock-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mock-min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit a591ea1

Please sign in to comment.