jonschlinkert / parse-comments

Parse JavaScript code comments. Works with block and line comments, and should work with CSS, LESS, SASS, or any language with the same comment formats.
https://github.com/jonschlinkert
MIT License
66 stars 23 forks source link

Class misidentified as a method #5

Closed mightyiam closed 5 years ago

mightyiam commented 9 years ago

This class gets wrongly misidentified as a method in o.context.type, thus ending up with a prefix . in the heading.

'use strict'

var _ = require('lodash')
var clone = require('udc')
var xtend = require('xtend')

/**
 * Gives birth to instances
 *
 * ```js
 * var History = require('object-history')
 * var initial = {foo: 'bar', name: 'victoria'}
 * var history = new History(initial)
 * ```
 *
 * @class History
 * @param {Object} `initial` The initial history point
 * @param {Object} `options` `limit`: `{Number}` Remember this many backward points
 * @constructor
 * @api public
 */

module.exports = function (initial, options) {
  var self = this
  self.options = xtend({
    limit: null
  }, options)

  self.notObjError = new Error('requires a plain object')
  if (!initial || !_.isPlainObject(initial)) {
    throw self.notObjError
  }

  self.current = clone(initial)
  self.changesets = {
    backward: [],
    forward: []
  }
}

var proto = module.exports.prototype

proto.add = require('./prototype/add')
proto.get = require('./prototype/get')
proto.lengthBackward = require('./prototype/length-backward')
proto.lengthForward = require('./prototype/length-forward')
proto.backward = require('./prototype/backward')
proto.forward = require('./prototype/forward')
proto.move = require('./prototype/move')
proto.forgetAllInDirection = require('./prototype/forget-all-in-direction')
proto.forgetAllBackward = require('./prototype/forget-all-backward')
proto.forgetAllForward = require('./prototype/forget-all-forward')
jonschlinkert commented 5 years ago

Closing since this library was refactored and this should no longer be an issue.