postdoc 0.2.0.beta4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/postdoc/postdoc_view_helper.rb +15 -0
- data/lib/postdoc.rb +34 -14
- metadata +20 -373
- data/lib/pdf.js +0 -27
- data/node_modules/agent-base/History.md +0 -113
- data/node_modules/agent-base/README.md +0 -145
- data/node_modules/agent-base/index.js +0 -160
- data/node_modules/agent-base/package.json +0 -35
- data/node_modules/agent-base/patch-core.js +0 -37
- data/node_modules/agent-base/test/ssl-cert-snakeoil.key +0 -15
- data/node_modules/agent-base/test/ssl-cert-snakeoil.pem +0 -12
- data/node_modules/agent-base/test/test.js +0 -673
- data/node_modules/async-limiter/LICENSE +0 -8
- data/node_modules/async-limiter/coverage/coverage.json +0 -1
- data/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html +0 -73
- data/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html +0 -246
- data/node_modules/async-limiter/coverage/lcov-report/base.css +0 -182
- data/node_modules/async-limiter/coverage/lcov-report/index.html +0 -73
- data/node_modules/async-limiter/coverage/lcov-report/prettify.css +0 -1
- data/node_modules/async-limiter/coverage/lcov-report/prettify.js +0 -1
- data/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- data/node_modules/async-limiter/coverage/lcov-report/sorter.js +0 -156
- data/node_modules/async-limiter/coverage/lcov.info +0 -74
- data/node_modules/async-limiter/index.js +0 -67
- data/node_modules/async-limiter/package.json +0 -35
- data/node_modules/async-limiter/readme.md +0 -132
- data/node_modules/balanced-match/LICENSE.md +0 -21
- data/node_modules/balanced-match/README.md +0 -91
- data/node_modules/balanced-match/index.js +0 -59
- data/node_modules/balanced-match/package.json +0 -49
- data/node_modules/brace-expansion/LICENSE +0 -21
- data/node_modules/brace-expansion/README.md +0 -129
- data/node_modules/brace-expansion/index.js +0 -201
- data/node_modules/brace-expansion/package.json +0 -47
- data/node_modules/buffer-from/index.js +0 -69
- data/node_modules/buffer-from/package.json +0 -16
- data/node_modules/buffer-from/readme.md +0 -69
- data/node_modules/buffer-from/test.js +0 -12
- data/node_modules/concat-map/LICENSE +0 -18
- data/node_modules/concat-map/README.markdown +0 -62
- data/node_modules/concat-map/example/map.js +0 -6
- data/node_modules/concat-map/index.js +0 -13
- data/node_modules/concat-map/package.json +0 -43
- data/node_modules/concat-map/test/map.js +0 -39
- data/node_modules/concat-stream/LICENSE +0 -24
- data/node_modules/concat-stream/index.js +0 -144
- data/node_modules/concat-stream/package.json +0 -55
- data/node_modules/concat-stream/readme.md +0 -102
- data/node_modules/core-util-is/LICENSE +0 -19
- data/node_modules/core-util-is/README.md +0 -3
- data/node_modules/core-util-is/float.patch +0 -604
- data/node_modules/core-util-is/lib/util.js +0 -107
- data/node_modules/core-util-is/package.json +0 -32
- data/node_modules/core-util-is/test.js +0 -68
- data/node_modules/debug/CHANGELOG.md +0 -395
- data/node_modules/debug/LICENSE +0 -19
- data/node_modules/debug/Makefile +0 -58
- data/node_modules/debug/README.md +0 -368
- data/node_modules/debug/karma.conf.js +0 -70
- data/node_modules/debug/node.js +0 -1
- data/node_modules/debug/package.json +0 -43
- data/node_modules/debug/src/browser.js +0 -195
- data/node_modules/debug/src/debug.js +0 -225
- data/node_modules/debug/src/index.js +0 -10
- data/node_modules/debug/src/node.js +0 -186
- data/node_modules/es6-promise/CHANGELOG.md +0 -151
- data/node_modules/es6-promise/LICENSE +0 -19
- data/node_modules/es6-promise/README.md +0 -97
- data/node_modules/es6-promise/auto.js +0 -4
- data/node_modules/es6-promise/dist/es6-promise.auto.js +0 -1181
- data/node_modules/es6-promise/dist/es6-promise.auto.map +0 -1
- data/node_modules/es6-promise/dist/es6-promise.auto.min.js +0 -1
- data/node_modules/es6-promise/dist/es6-promise.auto.min.map +0 -1
- data/node_modules/es6-promise/dist/es6-promise.js +0 -1179
- data/node_modules/es6-promise/dist/es6-promise.map +0 -1
- data/node_modules/es6-promise/dist/es6-promise.min.js +0 -1
- data/node_modules/es6-promise/dist/es6-promise.min.map +0 -1
- data/node_modules/es6-promise/es6-promise.d.ts +0 -81
- data/node_modules/es6-promise/lib/es6-promise/-internal.js +0 -266
- data/node_modules/es6-promise/lib/es6-promise/asap.js +0 -119
- data/node_modules/es6-promise/lib/es6-promise/enumerator.js +0 -113
- data/node_modules/es6-promise/lib/es6-promise/polyfill.js +0 -35
- data/node_modules/es6-promise/lib/es6-promise/promise/all.js +0 -52
- data/node_modules/es6-promise/lib/es6-promise/promise/race.js +0 -84
- data/node_modules/es6-promise/lib/es6-promise/promise/reject.js +0 -46
- data/node_modules/es6-promise/lib/es6-promise/promise/resolve.js +0 -48
- data/node_modules/es6-promise/lib/es6-promise/promise.js +0 -427
- data/node_modules/es6-promise/lib/es6-promise/then.js +0 -32
- data/node_modules/es6-promise/lib/es6-promise/utils.js +0 -21
- data/node_modules/es6-promise/lib/es6-promise.auto.js +0 -3
- data/node_modules/es6-promise/lib/es6-promise.js +0 -7
- data/node_modules/es6-promise/package.json +0 -75
- data/node_modules/es6-promisify/README.md +0 -89
- data/node_modules/es6-promisify/dist/promise.js +0 -73
- data/node_modules/es6-promisify/dist/promisify.js +0 -85
- data/node_modules/es6-promisify/package.json +0 -41
- data/node_modules/extract-zip/CONTRIBUTING.md +0 -1
- data/node_modules/extract-zip/LICENSE +0 -23
- data/node_modules/extract-zip/cli.js +0 -20
- data/node_modules/extract-zip/index.js +0 -205
- data/node_modules/extract-zip/node_modules/debug/CHANGELOG.md +0 -362
- data/node_modules/extract-zip/node_modules/debug/LICENSE +0 -19
- data/node_modules/extract-zip/node_modules/debug/Makefile +0 -50
- data/node_modules/extract-zip/node_modules/debug/README.md +0 -312
- data/node_modules/extract-zip/node_modules/debug/component.json +0 -19
- data/node_modules/extract-zip/node_modules/debug/karma.conf.js +0 -70
- data/node_modules/extract-zip/node_modules/debug/node.js +0 -1
- data/node_modules/extract-zip/node_modules/debug/package.json +0 -49
- data/node_modules/extract-zip/node_modules/debug/src/browser.js +0 -185
- data/node_modules/extract-zip/node_modules/debug/src/debug.js +0 -202
- data/node_modules/extract-zip/node_modules/debug/src/index.js +0 -10
- data/node_modules/extract-zip/node_modules/debug/src/inspector-log.js +0 -15
- data/node_modules/extract-zip/node_modules/debug/src/node.js +0 -248
- data/node_modules/extract-zip/package.json +0 -35
- data/node_modules/extract-zip/readme.md +0 -49
- data/node_modules/fd-slicer/CHANGELOG.md +0 -49
- data/node_modules/fd-slicer/LICENSE +0 -21
- data/node_modules/fd-slicer/README.md +0 -189
- data/node_modules/fd-slicer/index.js +0 -277
- data/node_modules/fd-slicer/package.json +0 -36
- data/node_modules/fd-slicer/test/test.js +0 -350
- data/node_modules/fs.realpath/LICENSE +0 -43
- data/node_modules/fs.realpath/README.md +0 -33
- data/node_modules/fs.realpath/index.js +0 -66
- data/node_modules/fs.realpath/old.js +0 -303
- data/node_modules/fs.realpath/package.json +0 -26
- data/node_modules/glob/LICENSE +0 -15
- data/node_modules/glob/README.md +0 -368
- data/node_modules/glob/changelog.md +0 -67
- data/node_modules/glob/common.js +0 -240
- data/node_modules/glob/glob.js +0 -790
- data/node_modules/glob/package.json +0 -43
- data/node_modules/glob/sync.js +0 -486
- data/node_modules/https-proxy-agent/History.md +0 -124
- data/node_modules/https-proxy-agent/README.md +0 -137
- data/node_modules/https-proxy-agent/index.js +0 -229
- data/node_modules/https-proxy-agent/package.json +0 -35
- data/node_modules/https-proxy-agent/test/ssl-cert-snakeoil.key +0 -15
- data/node_modules/https-proxy-agent/test/ssl-cert-snakeoil.pem +0 -12
- data/node_modules/https-proxy-agent/test/test.js +0 -342
- data/node_modules/inflight/LICENSE +0 -15
- data/node_modules/inflight/README.md +0 -37
- data/node_modules/inflight/inflight.js +0 -54
- data/node_modules/inflight/package.json +0 -29
- data/node_modules/inherits/LICENSE +0 -16
- data/node_modules/inherits/README.md +0 -42
- data/node_modules/inherits/inherits.js +0 -7
- data/node_modules/inherits/inherits_browser.js +0 -23
- data/node_modules/inherits/package.json +0 -29
- data/node_modules/isarray/Makefile +0 -6
- data/node_modules/isarray/README.md +0 -60
- data/node_modules/isarray/component.json +0 -19
- data/node_modules/isarray/index.js +0 -5
- data/node_modules/isarray/package.json +0 -45
- data/node_modules/isarray/test.js +0 -20
- data/node_modules/mime/CHANGELOG.md +0 -225
- data/node_modules/mime/CONTRIBUTING.md +0 -5
- data/node_modules/mime/LICENSE +0 -21
- data/node_modules/mime/Mime.js +0 -89
- data/node_modules/mime/README.md +0 -188
- data/node_modules/mime/cli.js +0 -10
- data/node_modules/mime/index.js +0 -4
- data/node_modules/mime/lite.js +0 -4
- data/node_modules/mime/package.json +0 -43
- data/node_modules/mime/src/README_js.md +0 -179
- data/node_modules/mime/src/build.js +0 -71
- data/node_modules/mime/src/test.js +0 -257
- data/node_modules/mime/types/other.json +0 -1
- data/node_modules/mime/types/standard.json +0 -1
- data/node_modules/minimatch/LICENSE +0 -15
- data/node_modules/minimatch/README.md +0 -209
- data/node_modules/minimatch/minimatch.js +0 -923
- data/node_modules/minimatch/package.json +0 -30
- data/node_modules/minimist/LICENSE +0 -18
- data/node_modules/minimist/example/parse.js +0 -2
- data/node_modules/minimist/index.js +0 -187
- data/node_modules/minimist/package.json +0 -40
- data/node_modules/minimist/readme.markdown +0 -73
- data/node_modules/minimist/test/dash.js +0 -24
- data/node_modules/minimist/test/default_bool.js +0 -20
- data/node_modules/minimist/test/dotted.js +0 -16
- data/node_modules/minimist/test/long.js +0 -31
- data/node_modules/minimist/test/parse.js +0 -318
- data/node_modules/minimist/test/parse_modified.js +0 -9
- data/node_modules/minimist/test/short.js +0 -67
- data/node_modules/minimist/test/whitespace.js +0 -8
- data/node_modules/mkdirp/LICENSE +0 -21
- data/node_modules/mkdirp/bin/cmd.js +0 -33
- data/node_modules/mkdirp/bin/usage.txt +0 -12
- data/node_modules/mkdirp/examples/pow.js +0 -6
- data/node_modules/mkdirp/index.js +0 -98
- data/node_modules/mkdirp/package.json +0 -27
- data/node_modules/mkdirp/readme.markdown +0 -100
- data/node_modules/mkdirp/test/chmod.js +0 -41
- data/node_modules/mkdirp/test/clobber.js +0 -38
- data/node_modules/mkdirp/test/mkdirp.js +0 -28
- data/node_modules/mkdirp/test/opts_fs.js +0 -29
- data/node_modules/mkdirp/test/opts_fs_sync.js +0 -27
- data/node_modules/mkdirp/test/perm.js +0 -32
- data/node_modules/mkdirp/test/perm_sync.js +0 -36
- data/node_modules/mkdirp/test/race.js +0 -37
- data/node_modules/mkdirp/test/rel.js +0 -32
- data/node_modules/mkdirp/test/return.js +0 -25
- data/node_modules/mkdirp/test/return_sync.js +0 -24
- data/node_modules/mkdirp/test/root.js +0 -19
- data/node_modules/mkdirp/test/sync.js +0 -32
- data/node_modules/mkdirp/test/umask.js +0 -28
- data/node_modules/mkdirp/test/umask_sync.js +0 -32
- data/node_modules/ms/index.js +0 -152
- data/node_modules/ms/license.md +0 -21
- data/node_modules/ms/package.json +0 -37
- data/node_modules/ms/readme.md +0 -51
- data/node_modules/once/LICENSE +0 -15
- data/node_modules/once/README.md +0 -79
- data/node_modules/once/once.js +0 -42
- data/node_modules/once/package.json +0 -33
- data/node_modules/path-is-absolute/index.js +0 -20
- data/node_modules/path-is-absolute/license +0 -21
- data/node_modules/path-is-absolute/package.json +0 -43
- data/node_modules/path-is-absolute/readme.md +0 -59
- data/node_modules/pend/LICENSE +0 -23
- data/node_modules/pend/README.md +0 -41
- data/node_modules/pend/index.js +0 -55
- data/node_modules/pend/package.json +0 -18
- data/node_modules/pend/test.js +0 -137
- data/node_modules/process-nextick-args/index.js +0 -44
- data/node_modules/process-nextick-args/license.md +0 -19
- data/node_modules/process-nextick-args/package.json +0 -25
- data/node_modules/process-nextick-args/readme.md +0 -18
- data/node_modules/progress/CHANGELOG.md +0 -115
- data/node_modules/progress/LICENSE +0 -22
- data/node_modules/progress/Makefile +0 -8
- data/node_modules/progress/README.md +0 -146
- data/node_modules/progress/index.js +0 -1
- data/node_modules/progress/lib/node-progress.js +0 -231
- data/node_modules/progress/package.json +0 -25
- data/node_modules/proxy-from-env/README.md +0 -131
- data/node_modules/proxy-from-env/index.js +0 -103
- data/node_modules/proxy-from-env/package.json +0 -35
- data/node_modules/proxy-from-env/test.js +0 -393
- data/node_modules/puppeteer/CONTRIBUTING.md +0 -206
- data/node_modules/puppeteer/DeviceDescriptors.js +0 -704
- data/node_modules/puppeteer/LICENSE +0 -202
- data/node_modules/puppeteer/README.md +0 -306
- data/node_modules/puppeteer/index.js +0 -28
- data/node_modules/puppeteer/install.js +0 -122
- data/node_modules/puppeteer/lib/Browser.js +0 -186
- data/node_modules/puppeteer/lib/BrowserFetcher.js +0 -279
- data/node_modules/puppeteer/lib/Connection.js +0 -246
- data/node_modules/puppeteer/lib/Coverage.js +0 -301
- data/node_modules/puppeteer/lib/Dialog.js +0 -84
- data/node_modules/puppeteer/lib/ElementHandle.js +0 -328
- data/node_modules/puppeteer/lib/EmulationManager.js +0 -89
- data/node_modules/puppeteer/lib/ExecutionContext.js +0 -232
- data/node_modules/puppeteer/lib/FrameManager.js +0 -997
- data/node_modules/puppeteer/lib/Input.js +0 -309
- data/node_modules/puppeteer/lib/Launcher.js +0 -310
- data/node_modules/puppeteer/lib/Multimap.js +0 -95
- data/node_modules/puppeteer/lib/NavigatorWatcher.js +0 -137
- data/node_modules/puppeteer/lib/NetworkManager.js +0 -796
- data/node_modules/puppeteer/lib/Page.js +0 -1098
- data/node_modules/puppeteer/lib/Pipe.js +0 -69
- data/node_modules/puppeteer/lib/Puppeteer.js +0 -60
- data/node_modules/puppeteer/lib/Target.js +0 -88
- data/node_modules/puppeteer/lib/TaskQueue.js +0 -17
- data/node_modules/puppeteer/lib/Tracing.js +0 -99
- data/node_modules/puppeteer/lib/USKeyboardLayout.js +0 -281
- data/node_modules/puppeteer/lib/helper.js +0 -248
- data/node_modules/puppeteer/node6/lib/Browser.js +0 -394
- data/node_modules/puppeteer/node6/lib/BrowserFetcher.js +0 -357
- data/node_modules/puppeteer/node6/lib/Connection.js +0 -350
- data/node_modules/puppeteer/node6/lib/Coverage.js +0 -561
- data/node_modules/puppeteer/node6/lib/Dialog.js +0 -136
- data/node_modules/puppeteer/node6/lib/ElementHandle.js +0 -796
- data/node_modules/puppeteer/node6/lib/EmulationManager.js +0 -115
- data/node_modules/puppeteer/node6/lib/ExecutionContext.js +0 -414
- data/node_modules/puppeteer/node6/lib/FrameManager.js +0 -1621
- data/node_modules/puppeteer/node6/lib/Input.js +0 -569
- data/node_modules/puppeteer/node6/lib/Launcher.js +0 -362
- data/node_modules/puppeteer/node6/lib/Multimap.js +0 -95
- data/node_modules/puppeteer/node6/lib/NavigatorWatcher.js +0 -163
- data/node_modules/puppeteer/node6/lib/NetworkManager.js +0 -1108
- data/node_modules/puppeteer/node6/lib/Page.js +0 -2242
- data/node_modules/puppeteer/node6/lib/Pipe.js +0 -69
- data/node_modules/puppeteer/node6/lib/Puppeteer.js +0 -60
- data/node_modules/puppeteer/node6/lib/Target.js +0 -114
- data/node_modules/puppeteer/node6/lib/TaskQueue.js +0 -17
- data/node_modules/puppeteer/node6/lib/Tracing.js +0 -177
- data/node_modules/puppeteer/node6/lib/USKeyboardLayout.js +0 -281
- data/node_modules/puppeteer/node6/lib/helper.js +0 -274
- data/node_modules/puppeteer/package.json +0 -61
- data/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- data/node_modules/readable-stream/GOVERNANCE.md +0 -136
- data/node_modules/readable-stream/LICENSE +0 -47
- data/node_modules/readable-stream/README.md +0 -58
- data/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- data/node_modules/readable-stream/duplex-browser.js +0 -1
- data/node_modules/readable-stream/duplex.js +0 -1
- data/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
- data/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
- data/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
- data/node_modules/readable-stream/lib/_stream_transform.js +0 -214
- data/node_modules/readable-stream/lib/_stream_writable.js +0 -687
- data/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
- data/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
- data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- data/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- data/node_modules/readable-stream/package.json +0 -52
- data/node_modules/readable-stream/passthrough.js +0 -1
- data/node_modules/readable-stream/readable-browser.js +0 -7
- data/node_modules/readable-stream/readable.js +0 -19
- data/node_modules/readable-stream/transform.js +0 -1
- data/node_modules/readable-stream/writable-browser.js +0 -1
- data/node_modules/readable-stream/writable.js +0 -8
- data/node_modules/rimraf/LICENSE +0 -15
- data/node_modules/rimraf/README.md +0 -101
- data/node_modules/rimraf/bin.js +0 -50
- data/node_modules/rimraf/package.json +0 -26
- data/node_modules/rimraf/rimraf.js +0 -364
- data/node_modules/safe-buffer/LICENSE +0 -21
- data/node_modules/safe-buffer/README.md +0 -584
- data/node_modules/safe-buffer/index.d.ts +0 -187
- data/node_modules/safe-buffer/index.js +0 -62
- data/node_modules/safe-buffer/package.json +0 -37
- data/node_modules/string_decoder/LICENSE +0 -48
- data/node_modules/string_decoder/README.md +0 -47
- data/node_modules/string_decoder/lib/string_decoder.js +0 -296
- data/node_modules/string_decoder/package.json +0 -31
- data/node_modules/typedarray/LICENSE +0 -35
- data/node_modules/typedarray/example/tarray.js +0 -4
- data/node_modules/typedarray/index.js +0 -630
- data/node_modules/typedarray/package.json +0 -55
- data/node_modules/typedarray/readme.markdown +0 -61
- data/node_modules/typedarray/test/server/undef_globals.js +0 -19
- data/node_modules/typedarray/test/tarray.js +0 -10
- data/node_modules/ultron/LICENSE +0 -22
- data/node_modules/ultron/README.md +0 -113
- data/node_modules/ultron/index.js +0 -136
- data/node_modules/ultron/package.json +0 -41
- data/node_modules/util-deprecate/History.md +0 -16
- data/node_modules/util-deprecate/LICENSE +0 -24
- data/node_modules/util-deprecate/README.md +0 -53
- data/node_modules/util-deprecate/browser.js +0 -67
- data/node_modules/util-deprecate/node.js +0 -6
- data/node_modules/util-deprecate/package.json +0 -27
- data/node_modules/wrappy/LICENSE +0 -15
- data/node_modules/wrappy/README.md +0 -36
- data/node_modules/wrappy/package.json +0 -29
- data/node_modules/wrappy/wrappy.js +0 -33
- data/node_modules/ws/LICENSE +0 -21
- data/node_modules/ws/README.md +0 -341
- data/node_modules/ws/index.js +0 -15
- data/node_modules/ws/lib/BufferUtil.js +0 -71
- data/node_modules/ws/lib/Constants.js +0 -10
- data/node_modules/ws/lib/ErrorCodes.js +0 -28
- data/node_modules/ws/lib/EventTarget.js +0 -151
- data/node_modules/ws/lib/Extensions.js +0 -203
- data/node_modules/ws/lib/PerMessageDeflate.js +0 -507
- data/node_modules/ws/lib/Receiver.js +0 -553
- data/node_modules/ws/lib/Sender.js +0 -412
- data/node_modules/ws/lib/Validation.js +0 -17
- data/node_modules/ws/lib/WebSocket.js +0 -717
- data/node_modules/ws/lib/WebSocketServer.js +0 -326
- data/node_modules/ws/package.json +0 -46
- data/node_modules/yauzl/LICENSE +0 -21
- data/node_modules/yauzl/README.md +0 -467
- data/node_modules/yauzl/index.js +0 -626
- data/node_modules/yauzl/package.json +0 -36
- data/package.json +0 -5
- data/yarn.lock +0 -240
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
var addSorting = (function () {
|
|
2
|
-
"use strict";
|
|
3
|
-
var cols,
|
|
4
|
-
currentSort = {
|
|
5
|
-
index: 0,
|
|
6
|
-
desc: false
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// returns the summary table element
|
|
10
|
-
function getTable() { return document.querySelector('.coverage-summary table'); }
|
|
11
|
-
// returns the thead element of the summary table
|
|
12
|
-
function getTableHeader() { return getTable().querySelector('thead tr'); }
|
|
13
|
-
// returns the tbody element of the summary table
|
|
14
|
-
function getTableBody() { return getTable().querySelector('tbody'); }
|
|
15
|
-
// returns the th element for nth column
|
|
16
|
-
function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; }
|
|
17
|
-
|
|
18
|
-
// loads all columns
|
|
19
|
-
function loadColumns() {
|
|
20
|
-
var colNodes = getTableHeader().querySelectorAll('th'),
|
|
21
|
-
colNode,
|
|
22
|
-
cols = [],
|
|
23
|
-
col,
|
|
24
|
-
i;
|
|
25
|
-
|
|
26
|
-
for (i = 0; i < colNodes.length; i += 1) {
|
|
27
|
-
colNode = colNodes[i];
|
|
28
|
-
col = {
|
|
29
|
-
key: colNode.getAttribute('data-col'),
|
|
30
|
-
sortable: !colNode.getAttribute('data-nosort'),
|
|
31
|
-
type: colNode.getAttribute('data-type') || 'string'
|
|
32
|
-
};
|
|
33
|
-
cols.push(col);
|
|
34
|
-
if (col.sortable) {
|
|
35
|
-
col.defaultDescSort = col.type === 'number';
|
|
36
|
-
colNode.innerHTML = colNode.innerHTML + '<span class="sorter"></span>';
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return cols;
|
|
40
|
-
}
|
|
41
|
-
// attaches a data attribute to every tr element with an object
|
|
42
|
-
// of data values keyed by column name
|
|
43
|
-
function loadRowData(tableRow) {
|
|
44
|
-
var tableCols = tableRow.querySelectorAll('td'),
|
|
45
|
-
colNode,
|
|
46
|
-
col,
|
|
47
|
-
data = {},
|
|
48
|
-
i,
|
|
49
|
-
val;
|
|
50
|
-
for (i = 0; i < tableCols.length; i += 1) {
|
|
51
|
-
colNode = tableCols[i];
|
|
52
|
-
col = cols[i];
|
|
53
|
-
val = colNode.getAttribute('data-value');
|
|
54
|
-
if (col.type === 'number') {
|
|
55
|
-
val = Number(val);
|
|
56
|
-
}
|
|
57
|
-
data[col.key] = val;
|
|
58
|
-
}
|
|
59
|
-
return data;
|
|
60
|
-
}
|
|
61
|
-
// loads all row data
|
|
62
|
-
function loadData() {
|
|
63
|
-
var rows = getTableBody().querySelectorAll('tr'),
|
|
64
|
-
i;
|
|
65
|
-
|
|
66
|
-
for (i = 0; i < rows.length; i += 1) {
|
|
67
|
-
rows[i].data = loadRowData(rows[i]);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// sorts the table using the data for the ith column
|
|
71
|
-
function sortByIndex(index, desc) {
|
|
72
|
-
var key = cols[index].key,
|
|
73
|
-
sorter = function (a, b) {
|
|
74
|
-
a = a.data[key];
|
|
75
|
-
b = b.data[key];
|
|
76
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
77
|
-
},
|
|
78
|
-
finalSorter = sorter,
|
|
79
|
-
tableBody = document.querySelector('.coverage-summary tbody'),
|
|
80
|
-
rowNodes = tableBody.querySelectorAll('tr'),
|
|
81
|
-
rows = [],
|
|
82
|
-
i;
|
|
83
|
-
|
|
84
|
-
if (desc) {
|
|
85
|
-
finalSorter = function (a, b) {
|
|
86
|
-
return -1 * sorter(a, b);
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
for (i = 0; i < rowNodes.length; i += 1) {
|
|
91
|
-
rows.push(rowNodes[i]);
|
|
92
|
-
tableBody.removeChild(rowNodes[i]);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
rows.sort(finalSorter);
|
|
96
|
-
|
|
97
|
-
for (i = 0; i < rows.length; i += 1) {
|
|
98
|
-
tableBody.appendChild(rows[i]);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
// removes sort indicators for current column being sorted
|
|
102
|
-
function removeSortIndicators() {
|
|
103
|
-
var col = getNthColumn(currentSort.index),
|
|
104
|
-
cls = col.className;
|
|
105
|
-
|
|
106
|
-
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
|
107
|
-
col.className = cls;
|
|
108
|
-
}
|
|
109
|
-
// adds sort indicators for current column being sorted
|
|
110
|
-
function addSortIndicators() {
|
|
111
|
-
getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted';
|
|
112
|
-
}
|
|
113
|
-
// adds event listeners for all sorter widgets
|
|
114
|
-
function enableUI() {
|
|
115
|
-
var i,
|
|
116
|
-
el,
|
|
117
|
-
ithSorter = function ithSorter(i) {
|
|
118
|
-
var col = cols[i];
|
|
119
|
-
|
|
120
|
-
return function () {
|
|
121
|
-
var desc = col.defaultDescSort;
|
|
122
|
-
|
|
123
|
-
if (currentSort.index === i) {
|
|
124
|
-
desc = !currentSort.desc;
|
|
125
|
-
}
|
|
126
|
-
sortByIndex(i, desc);
|
|
127
|
-
removeSortIndicators();
|
|
128
|
-
currentSort.index = i;
|
|
129
|
-
currentSort.desc = desc;
|
|
130
|
-
addSortIndicators();
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
for (i =0 ; i < cols.length; i += 1) {
|
|
134
|
-
if (cols[i].sortable) {
|
|
135
|
-
el = getNthColumn(i).querySelector('.sorter');
|
|
136
|
-
if (el.addEventListener) {
|
|
137
|
-
el.addEventListener('click', ithSorter(i));
|
|
138
|
-
} else {
|
|
139
|
-
el.attachEvent('onclick', ithSorter(i));
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
// adds sorting functionality to the UI
|
|
145
|
-
return function () {
|
|
146
|
-
if (!getTable()) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
cols = loadColumns();
|
|
150
|
-
loadData(cols);
|
|
151
|
-
addSortIndicators();
|
|
152
|
-
enableUI();
|
|
153
|
-
};
|
|
154
|
-
})();
|
|
155
|
-
|
|
156
|
-
window.addEventListener('load', addSorting);
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
TN:
|
|
2
|
-
SF:/Users/samuelreed/git/forks/async-throttle/index.js
|
|
3
|
-
FN:3,Queue
|
|
4
|
-
FN:22,(anonymous_2)
|
|
5
|
-
FN:23,(anonymous_3)
|
|
6
|
-
FN:31,(anonymous_4)
|
|
7
|
-
FN:36,(anonymous_5)
|
|
8
|
-
FN:55,(anonymous_6)
|
|
9
|
-
FN:62,done
|
|
10
|
-
FNF:7
|
|
11
|
-
FNH:7
|
|
12
|
-
FNDA:7,Queue
|
|
13
|
-
FNDA:3,(anonymous_2)
|
|
14
|
-
FNDA:13,(anonymous_3)
|
|
15
|
-
FNDA:19,(anonymous_4)
|
|
16
|
-
FNDA:45,(anonymous_5)
|
|
17
|
-
FNDA:6,(anonymous_6)
|
|
18
|
-
FNDA:13,done
|
|
19
|
-
DA:3,1
|
|
20
|
-
DA:4,7
|
|
21
|
-
DA:5,1
|
|
22
|
-
DA:8,6
|
|
23
|
-
DA:9,6
|
|
24
|
-
DA:10,6
|
|
25
|
-
DA:11,6
|
|
26
|
-
DA:12,6
|
|
27
|
-
DA:13,6
|
|
28
|
-
DA:16,1
|
|
29
|
-
DA:22,1
|
|
30
|
-
DA:23,3
|
|
31
|
-
DA:24,13
|
|
32
|
-
DA:25,13
|
|
33
|
-
DA:26,13
|
|
34
|
-
DA:30,1
|
|
35
|
-
DA:32,19
|
|
36
|
-
DA:36,1
|
|
37
|
-
DA:37,45
|
|
38
|
-
DA:38,6
|
|
39
|
-
DA:40,39
|
|
40
|
-
DA:41,13
|
|
41
|
-
DA:42,13
|
|
42
|
-
DA:43,13
|
|
43
|
-
DA:44,13
|
|
44
|
-
DA:47,39
|
|
45
|
-
DA:48,18
|
|
46
|
-
DA:49,6
|
|
47
|
-
DA:50,6
|
|
48
|
-
DA:55,1
|
|
49
|
-
DA:56,6
|
|
50
|
-
DA:57,6
|
|
51
|
-
DA:58,6
|
|
52
|
-
DA:62,1
|
|
53
|
-
DA:63,13
|
|
54
|
-
DA:64,13
|
|
55
|
-
DA:67,1
|
|
56
|
-
LF:37
|
|
57
|
-
LH:37
|
|
58
|
-
BRDA:4,1,0,1
|
|
59
|
-
BRDA:4,1,1,6
|
|
60
|
-
BRDA:8,2,0,6
|
|
61
|
-
BRDA:8,2,1,5
|
|
62
|
-
BRDA:9,3,0,6
|
|
63
|
-
BRDA:9,3,1,5
|
|
64
|
-
BRDA:37,4,0,6
|
|
65
|
-
BRDA:37,4,1,39
|
|
66
|
-
BRDA:40,5,0,13
|
|
67
|
-
BRDA:40,5,1,26
|
|
68
|
-
BRDA:47,6,0,18
|
|
69
|
-
BRDA:47,6,1,21
|
|
70
|
-
BRDA:56,7,0,6
|
|
71
|
-
BRDA:56,7,1,0
|
|
72
|
-
BRF:14
|
|
73
|
-
BRH:13
|
|
74
|
-
end_of_record
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function Queue(options) {
|
|
4
|
-
if (!(this instanceof Queue)) {
|
|
5
|
-
return new Queue(options);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
options = options || {};
|
|
9
|
-
this.concurrency = options.concurrency || Infinity;
|
|
10
|
-
this.pending = 0;
|
|
11
|
-
this.jobs = [];
|
|
12
|
-
this.cbs = [];
|
|
13
|
-
this._done = done.bind(this);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var arrayAddMethods = [
|
|
17
|
-
'push',
|
|
18
|
-
'unshift',
|
|
19
|
-
'splice'
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
arrayAddMethods.forEach(function(method) {
|
|
23
|
-
Queue.prototype[method] = function() {
|
|
24
|
-
var methodResult = Array.prototype[method].apply(this.jobs, arguments);
|
|
25
|
-
this._run();
|
|
26
|
-
return methodResult;
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
Object.defineProperty(Queue.prototype, 'length', {
|
|
31
|
-
get: function() {
|
|
32
|
-
return this.pending + this.jobs.length;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
Queue.prototype._run = function() {
|
|
37
|
-
if (this.pending === this.concurrency) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (this.jobs.length) {
|
|
41
|
-
var job = this.jobs.shift();
|
|
42
|
-
this.pending++;
|
|
43
|
-
job(this._done);
|
|
44
|
-
this._run();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (this.pending === 0) {
|
|
48
|
-
while (this.cbs.length !== 0) {
|
|
49
|
-
var cb = this.cbs.pop();
|
|
50
|
-
process.nextTick(cb);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
Queue.prototype.onDone = function(cb) {
|
|
56
|
-
if (typeof cb === 'function') {
|
|
57
|
-
this.cbs.push(cb);
|
|
58
|
-
this._run();
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
function done() {
|
|
63
|
-
this.pending--;
|
|
64
|
-
this._run();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
module.exports = Queue;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "async-limiter",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "asynchronous function queue with adjustable concurrency",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"throttle",
|
|
7
|
-
"async",
|
|
8
|
-
"limiter",
|
|
9
|
-
"asynchronous",
|
|
10
|
-
"job",
|
|
11
|
-
"task",
|
|
12
|
-
"concurrency",
|
|
13
|
-
"concurrent"
|
|
14
|
-
],
|
|
15
|
-
"dependencies": {},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"coveralls": "^2.11.2",
|
|
18
|
-
"eslint": "^4.6.1",
|
|
19
|
-
"eslint-plugin-mocha": "^4.11.0",
|
|
20
|
-
"intelli-espower-loader": "^1.0.1",
|
|
21
|
-
"istanbul": "^0.3.2",
|
|
22
|
-
"mocha": "^3.5.2",
|
|
23
|
-
"power-assert": "^1.4.4"
|
|
24
|
-
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"test": "mocha --R intelli-espower-loader test/",
|
|
27
|
-
"travis": "npm run lint && npm run coverage",
|
|
28
|
-
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls",
|
|
29
|
-
"example": "node example",
|
|
30
|
-
"lint": "eslint ."
|
|
31
|
-
},
|
|
32
|
-
"repository": "https://github.com/strml/async-limiter.git",
|
|
33
|
-
"author": "Samuel Reed <samuel.trace.reed@gmail.com",
|
|
34
|
-
"license": "MIT"
|
|
35
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
# Async-Limiter
|
|
2
|
-
|
|
3
|
-
A module for limiting concurrent asynchronous actions in flight. Forked from [queue](https://github.com/jessetane/queue).
|
|
4
|
-
|
|
5
|
-
[](http://www.npmjs.org/async-limiter)
|
|
6
|
-
[](https://travis-ci.org/STRML/async-limiter)
|
|
7
|
-
[](https://coveralls.io/r/STRML/async-limiter)
|
|
8
|
-
|
|
9
|
-
This module exports a class `Limiter` that implements some of the `Array` API.
|
|
10
|
-
Pass async functions (ones that accept a callback or return a promise) to an instance's additive array methods.
|
|
11
|
-
|
|
12
|
-
## Motivation
|
|
13
|
-
|
|
14
|
-
Certain functions, like `zlib`, have [undesirable behavior](https://github.com/nodejs/node/issues/8871#issuecomment-250915913) when
|
|
15
|
-
run at infinite concurrency.
|
|
16
|
-
|
|
17
|
-
In this case, it is actually faster, and takes far less memory, to limit concurrency.
|
|
18
|
-
|
|
19
|
-
This module should do the absolute minimum work necessary to queue up functions. PRs are welcome that would
|
|
20
|
-
make this module faster or lighter, but new functionality is not desired.
|
|
21
|
-
|
|
22
|
-
Style should confirm to nodejs/node style.
|
|
23
|
-
|
|
24
|
-
## Example
|
|
25
|
-
|
|
26
|
-
``` javascript
|
|
27
|
-
var Limiter = require('async-limiter')
|
|
28
|
-
|
|
29
|
-
var t = new Limiter({concurrency: 2});
|
|
30
|
-
var results = []
|
|
31
|
-
|
|
32
|
-
// add jobs using the familiar Array API
|
|
33
|
-
t.push(function (cb) {
|
|
34
|
-
results.push('two')
|
|
35
|
-
cb()
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
t.push(
|
|
39
|
-
function (cb) {
|
|
40
|
-
results.push('four')
|
|
41
|
-
cb()
|
|
42
|
-
},
|
|
43
|
-
function (cb) {
|
|
44
|
-
results.push('five')
|
|
45
|
-
cb()
|
|
46
|
-
}
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
t.unshift(function (cb) {
|
|
50
|
-
results.push('one')
|
|
51
|
-
cb()
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
t.splice(2, 0, function (cb) {
|
|
55
|
-
results.push('three')
|
|
56
|
-
cb()
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
// Jobs run automatically. If you want a callback when all are done,
|
|
60
|
-
// call 'onDone()'.
|
|
61
|
-
t.onDone(function () {
|
|
62
|
-
console.log('all done:', results)
|
|
63
|
-
})
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Zlib Example
|
|
67
|
-
|
|
68
|
-
```js
|
|
69
|
-
const zlib = require('zlib');
|
|
70
|
-
const Limiter = require('async-limiter');
|
|
71
|
-
|
|
72
|
-
const message = {some: "data"};
|
|
73
|
-
const payload = new Buffer(JSON.stringify(message));
|
|
74
|
-
|
|
75
|
-
// Try with different concurrency values to see how this actually
|
|
76
|
-
// slows significantly with higher concurrency!
|
|
77
|
-
//
|
|
78
|
-
// 5: 1398.607ms
|
|
79
|
-
// 10: 1375.668ms
|
|
80
|
-
// Infinity: 4423.300ms
|
|
81
|
-
//
|
|
82
|
-
const t = new Limiter({concurrency: 5});
|
|
83
|
-
function deflate(payload, cb) {
|
|
84
|
-
t.push(function(done) {
|
|
85
|
-
zlib.deflate(payload, function(err, buffer) {
|
|
86
|
-
done();
|
|
87
|
-
cb(err, buffer);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
console.time('deflate');
|
|
93
|
-
for(let i = 0; i < 30000; ++i) {
|
|
94
|
-
deflate(payload, function (err, buffer) {});
|
|
95
|
-
}
|
|
96
|
-
q.onDone(function() {
|
|
97
|
-
console.timeEnd('deflate');
|
|
98
|
-
});
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Install
|
|
102
|
-
|
|
103
|
-
`npm install async-limiter`
|
|
104
|
-
|
|
105
|
-
## Test
|
|
106
|
-
|
|
107
|
-
`npm test`
|
|
108
|
-
|
|
109
|
-
## API
|
|
110
|
-
|
|
111
|
-
### `var t = new Limiter([opts])`
|
|
112
|
-
Constructor. `opts` may contain inital values for:
|
|
113
|
-
* `q.concurrency`
|
|
114
|
-
|
|
115
|
-
## Instance methods
|
|
116
|
-
|
|
117
|
-
### `q.onDone(fn)`
|
|
118
|
-
`fn` will be called once and only once, when the queue is empty.
|
|
119
|
-
|
|
120
|
-
## Instance methods mixed in from `Array`
|
|
121
|
-
Mozilla has docs on how these methods work [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).
|
|
122
|
-
### `q.push(element1, ..., elementN)`
|
|
123
|
-
### `q.unshift(element1, ..., elementN)`
|
|
124
|
-
### `q.splice(index , howMany[, element1[, ...[, elementN]]])`
|
|
125
|
-
|
|
126
|
-
## Properties
|
|
127
|
-
### `q.concurrency`
|
|
128
|
-
Max number of jobs the queue should process concurrently, defaults to `Infinity`.
|
|
129
|
-
|
|
130
|
-
### `q.length`
|
|
131
|
-
Jobs pending + jobs to process (readonly).
|
|
132
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
(MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
-
so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# balanced-match
|
|
2
|
-
|
|
3
|
-
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
|
4
|
-
|
|
5
|
-
[](http://travis-ci.org/juliangruber/balanced-match)
|
|
6
|
-
[](https://www.npmjs.org/package/balanced-match)
|
|
7
|
-
|
|
8
|
-
[](https://ci.testling.com/juliangruber/balanced-match)
|
|
9
|
-
|
|
10
|
-
## Example
|
|
11
|
-
|
|
12
|
-
Get the first matching pair of braces:
|
|
13
|
-
|
|
14
|
-
```js
|
|
15
|
-
var balanced = require('balanced-match');
|
|
16
|
-
|
|
17
|
-
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
|
18
|
-
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
|
19
|
-
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
The matches are:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
$ node example.js
|
|
26
|
-
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
|
27
|
-
{ start: 3,
|
|
28
|
-
end: 9,
|
|
29
|
-
pre: 'pre',
|
|
30
|
-
body: 'first',
|
|
31
|
-
post: 'between{second}post' }
|
|
32
|
-
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## API
|
|
36
|
-
|
|
37
|
-
### var m = balanced(a, b, str)
|
|
38
|
-
|
|
39
|
-
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
|
40
|
-
object with those keys:
|
|
41
|
-
|
|
42
|
-
* **start** the index of the first match of `a`
|
|
43
|
-
* **end** the index of the matching `b`
|
|
44
|
-
* **pre** the preamble, `a` and `b` not included
|
|
45
|
-
* **body** the match, `a` and `b` not included
|
|
46
|
-
* **post** the postscript, `a` and `b` not included
|
|
47
|
-
|
|
48
|
-
If there's no match, `undefined` will be returned.
|
|
49
|
-
|
|
50
|
-
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
|
51
|
-
|
|
52
|
-
### var r = balanced.range(a, b, str)
|
|
53
|
-
|
|
54
|
-
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
|
55
|
-
array with indexes: `[ <a index>, <b index> ]`.
|
|
56
|
-
|
|
57
|
-
If there's no match, `undefined` will be returned.
|
|
58
|
-
|
|
59
|
-
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
|
60
|
-
|
|
61
|
-
## Installation
|
|
62
|
-
|
|
63
|
-
With [npm](https://npmjs.org) do:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
npm install balanced-match
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## License
|
|
70
|
-
|
|
71
|
-
(MIT)
|
|
72
|
-
|
|
73
|
-
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
74
|
-
|
|
75
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
76
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
77
|
-
the Software without restriction, including without limitation the rights to
|
|
78
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
79
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
|
80
|
-
so, subject to the following conditions:
|
|
81
|
-
|
|
82
|
-
The above copyright notice and this permission notice shall be included in all
|
|
83
|
-
copies or substantial portions of the Software.
|
|
84
|
-
|
|
85
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
86
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
87
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
88
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
89
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
90
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
91
|
-
SOFTWARE.
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
module.exports = balanced;
|
|
3
|
-
function balanced(a, b, str) {
|
|
4
|
-
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
5
|
-
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
6
|
-
|
|
7
|
-
var r = range(a, b, str);
|
|
8
|
-
|
|
9
|
-
return r && {
|
|
10
|
-
start: r[0],
|
|
11
|
-
end: r[1],
|
|
12
|
-
pre: str.slice(0, r[0]),
|
|
13
|
-
body: str.slice(r[0] + a.length, r[1]),
|
|
14
|
-
post: str.slice(r[1] + b.length)
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function maybeMatch(reg, str) {
|
|
19
|
-
var m = str.match(reg);
|
|
20
|
-
return m ? m[0] : null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
balanced.range = range;
|
|
24
|
-
function range(a, b, str) {
|
|
25
|
-
var begs, beg, left, right, result;
|
|
26
|
-
var ai = str.indexOf(a);
|
|
27
|
-
var bi = str.indexOf(b, ai + 1);
|
|
28
|
-
var i = ai;
|
|
29
|
-
|
|
30
|
-
if (ai >= 0 && bi > 0) {
|
|
31
|
-
begs = [];
|
|
32
|
-
left = str.length;
|
|
33
|
-
|
|
34
|
-
while (i >= 0 && !result) {
|
|
35
|
-
if (i == ai) {
|
|
36
|
-
begs.push(i);
|
|
37
|
-
ai = str.indexOf(a, i + 1);
|
|
38
|
-
} else if (begs.length == 1) {
|
|
39
|
-
result = [ begs.pop(), bi ];
|
|
40
|
-
} else {
|
|
41
|
-
beg = begs.pop();
|
|
42
|
-
if (beg < left) {
|
|
43
|
-
left = beg;
|
|
44
|
-
right = bi;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
bi = str.indexOf(b, i + 1);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
i = ai < bi && ai >= 0 ? ai : bi;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (begs.length) {
|
|
54
|
-
result = [ left, right ];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "balanced-match",
|
|
3
|
-
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git://github.com/juliangruber/balanced-match.git"
|
|
8
|
-
},
|
|
9
|
-
"homepage": "https://github.com/juliangruber/balanced-match",
|
|
10
|
-
"main": "index.js",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"test": "make test",
|
|
13
|
-
"bench": "make bench"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"matcha": "^0.7.0",
|
|
18
|
-
"tape": "^4.6.0"
|
|
19
|
-
},
|
|
20
|
-
"keywords": [
|
|
21
|
-
"match",
|
|
22
|
-
"regexp",
|
|
23
|
-
"test",
|
|
24
|
-
"balanced",
|
|
25
|
-
"parse"
|
|
26
|
-
],
|
|
27
|
-
"author": {
|
|
28
|
-
"name": "Julian Gruber",
|
|
29
|
-
"email": "mail@juliangruber.com",
|
|
30
|
-
"url": "http://juliangruber.com"
|
|
31
|
-
},
|
|
32
|
-
"license": "MIT",
|
|
33
|
-
"testling": {
|
|
34
|
-
"files": "test/*.js",
|
|
35
|
-
"browsers": [
|
|
36
|
-
"ie/8..latest",
|
|
37
|
-
"firefox/20..latest",
|
|
38
|
-
"firefox/nightly",
|
|
39
|
-
"chrome/25..latest",
|
|
40
|
-
"chrome/canary",
|
|
41
|
-
"opera/12..latest",
|
|
42
|
-
"opera/next",
|
|
43
|
-
"safari/5.1..latest",
|
|
44
|
-
"ipad/6.0..latest",
|
|
45
|
-
"iphone/6.0..latest",
|
|
46
|
-
"android-browser/4.2..latest"
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
}
|