code: function rimrafSync (p, options) {
    options = options || {}
    defaults(options)
  
    assert(p, 'rimraf: missing path')
    assert.equal(typeof p, 'string', 'rimraf: path should be a string')
    assert(options, 'rimraf: missing options')
    assert.equal(typeof options, 'object', 'rimraf: options should be object')
  
    var results
  
    if (options.disableGlob || !glob.hasMagic(p)) {
      results = [p]
    } else {
      try {
        options.lstatSync(p)
        results = [p]
      } catch (er) {
        results = glob.sync(p, options.glob)
      }
    }
  
    if (!results.length)
      return
  
    for (var i = 0; i < results.length; i++) {
      var p = results[i]
  
      try {
        var st = options.lstatSync(p)
      } catch (er) {
        if (er.code === "ENOENT")
          return
  
        // Windows can EPERM on stat.  Life is suffering.
        if (er.code === "EPERM" && isWindows)
          fixWinEPERMSync(p, options, er)
      }
  
      try {
        // sunos lets the root user unlink directories, which is... weird.
        if (st && st.isDirectory())
          rmdirSync(p, options, null)
        else
          options.unlinkSync(p)
      } catch (er) {
        if (er.code === "ENOENT")
          return
        if (er.code === "EPERM")
          return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
        if (er.code !== "EISDIR")
          throw er
  
        rmdirSync(p, options, er)
      }
    }
  }
docs: this looks simpler, and is strictly *faster*, but will tie up the JavaScript thread and fail on excessively deep directory trees.