How to use the extendr.deep function in extendr

To help you get started, we’ve selected a few extendr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bevry-archive / feedr / source / index.js View on Github external
constructor(config = {}) {
		// Prepare
		const me = this

		// Extend and dereference our configuration
		this.config = extendr.deep(
			{
				log: null,
				cache: 1000 * 60 * 60 * 24, // one day by default
				tmpPath: null,
				requestOptions: null,
				plugins: null
			},
			this.config || {},
			config
		)

		// Get the temp path right away
		safeps.getTmpPath(function(err, tmpPath) {
			if (err) {
				console.error(err)
			} else {
github bevry / taskgroup / source / taskgroup.js View on Github external
setNestedTaskConfig(opts) {
		// Fetch and copy options to the state's nested task configuration
		extendr.deep(this.state.nestedTaskConfig, opts)

		// Chain
		return this
	}
github bevry / taskgroup / source / taskgroup.js View on Github external
args.forEach(function(arg) {
			if (arg == null) return
			const type = typeof arg
			switch (type) {
				case 'string':
					opts.name = arg
					break
				case 'function':
					opts.method = arg
					break
				case 'object':
					extendr.deep(opts, arg) // @TODO why deep?
					break
				default: {
					throw new Error(
						`Unknown argument type of [${type}] given to TaskGroup::setConfig()`
					)
				}
			}
		})
github bevry-archive / feedr / source / index.js View on Github external
tasks.addTask(function(complete) {
				// Prepare
				if (typeChecker.isString(feed)) {
					feed = { url: feed }
				}
				feeds[index] = feed = extendr.deep({}, defaultfeed, feed)

				// Read
				me.readFeed(feed, function(err, data) {
					// Handle
					if (err) {
						me.log(
							'warn',
							`Feedr failed to fetch [${feed.url}] to [${feed.path}]`,
							err.stack
						)
						failures.push(err)
					} else {
						results[index] = data
					}

					// Complete
github bevry-archive / feedr / source / index.js View on Github external
})
					}
				})
				checkTasks.run()
			}
		}

		// Raw
		else {
			checkResponse = function(opts, checkComplete) {
				checkComplete()
			}
		}

		// Request options
		const requestOptions = extendr.deep(
			{
				url: feed.url,
				timeout: 1 * 60 * 1000,
				encoding: null,
				headers: {
					'User-Agent': 'Wget/1.14 (linux-gnu)'
				}
			},
			me.config.requestOptions || {},
			feed.requestOptions || {}
		)

		// Read a file
		function readFile(path, readFileComplete) {
			// Log
			me.log(
github bevry / caterpillar / source / transform.js View on Github external
setConfig(...configs) {
		deep(this._config, ...configs)
		this.emit('config', ...configs)
		return this
	}
github bevry / caterpillar / source / logger.js View on Github external
setConfig(...configs) {
		deep(this._config, ...configs)
		this.emit('config', ...configs)
		return this
	}
github bevry / taskgroup / source / task.js View on Github external
args.forEach(function(arg) {
			if (arg == null) return
			const type = typeof arg
			switch (type) {
				case 'string':
					opts.name = arg
					break
				case 'function':
					opts.method = arg
					break
				case 'object':
					extendr.deep(opts, arg)
					break
				default: {
					throw new Error(
						`Unknown argument type of [${type}] given to Task::setConfig()`
					)
				}
			}
		})

extendr

Utilities for cloning, extending, and de-referencing objects in shallow, deep, and safe ways

Artistic-2.0
Latest version published 9 months ago

Package Health Score

61 / 100
Full package analysis