Sha256: 8d7257e620622a2fb0b571c8753da28caa4a93050e239c298154820eeac30a82
Contents?: true
Size: 918 Bytes
Versions: 23
Compression:
Stored size: 918 Bytes
Contents
'use strict' var xtend = require('xtend') var escapes = require('markdown-escapes') var defaults = require('./defaults') module.exports = setOptions function setOptions(options) { var self = this var current = self.options var key var value if (options == null) { options = {} } else if (typeof options === 'object') { options = xtend(options) } else { throw new Error('Invalid value `' + options + '` for setting `options`') } for (key in defaults) { value = options[key] if (value == null) { value = current[key] } if ( (key !== 'blocks' && typeof value !== 'boolean') || (key === 'blocks' && typeof value !== 'object') ) { throw new Error( 'Invalid value `' + value + '` for setting `options.' + key + '`' ) } options[key] = value } self.options = options self.escape = escapes(options) return self }
Version data entries
23 entries across 23 versions & 1 rubygems