How to use the extendr.defaults 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 / projectz / source / lib / projectz.js View on Github external
if (!isObject(value)) {
					next(
						new Error(
							`projectz: custom package data for package ${name} must be an object`
						)
					)
					return this
				}
			}
		}

		// ----------------------------------
		// Merging

		// Set some basic object defaults
		extendr.defaults(this.mergedPackageData, {
			badges: {},
			readmes: {},
			packages: {},
			repository: {},
			github: {}
			// contributors: [],
			// sponsors: [],
			// maintainers: [],
			// authors: []
		})

		// Ensure badge config
		if (!this.mergedPackageData.badges.list)
			this.mergedPackageData.badges.list = []
		if (!this.mergedPackageData.badges.config)
			this.mergedPackageData.badges.config = {}
github bevry / taskgroup / source / taskgroup.js View on Github external
if (this.prepare) {
			this.prepare(...args)
		}

		// State defaults
		extendr.defaults(this.state, {
			result: null,
			error: null,
			status: 'created',
			itemsRemaining: [],
			itemsExecutingCount: 0,
			itemsDoneCount: 0
		})

		// Configuration defaults
		extendr.defaults(this.config, {
			// Standard
			storeResult: null,
			destroyOnceDone: true,
			parent: null,

			// Unique to TaskGroup
			method: null,
			abortOnError: true,
			destroyDoneItems: true,
			nestedTaskConfig: {},
			nestedTaskGroupConfig: {},
			emitNestedEvents: false,
			concurrency: 1,
			run: null
		})
github bevry / taskgroup / source / task.js View on Github external
constructor(...args) {
		// Initialise BaseInterface
		super()

		// State defaults
		extendr.defaults(this.state, {
			result: null,
			error: null,
			status: 'created'
		})

		// Configuration defaults
		extendr.defaults(this.config, {
			// Standard
			storeResult: null,
			destroyOnceDone: true,
			parent: null,

			// Unique to Task
			method: null,
			errorOnExcessCompletions: true,
			ambi: true,
github bevry / taskgroup / source / taskgroup.js View on Github external
constructor(...args) {
		super()

		// Prepare (used for class extensions)
		if (this.prepare) {
			this.prepare(...args)
		}

		// State defaults
		extendr.defaults(this.state, {
			result: null,
			error: null,
			status: 'created',
			itemsRemaining: [],
			itemsExecutingCount: 0,
			itemsDoneCount: 0
		})

		// Configuration defaults
		extendr.defaults(this.config, {
			// Standard
			storeResult: null,
			destroyOnceDone: true,
			parent: null,

			// Unique to TaskGroup
github bevry / taskgroup / source / task.js View on Github external
constructor(...args) {
		// Initialise BaseInterface
		super()

		// State defaults
		extendr.defaults(this.state, {
			result: null,
			error: null,
			status: 'created'
		})

		// Configuration defaults
		extendr.defaults(this.config, {
			// Standard
			storeResult: null,
			destroyOnceDone: true,
			parent: null,

			// Unique to Task
			method: null,
			errorOnExcessCompletions: true,
			ambi: true,
			domain: null,
			args: null
		})

		// Apply user configuration
		this.setConfig(...args)
	}

extendr

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

Artistic-2.0
Latest version published 11 months ago

Package Health Score

61 / 100
Full package analysis