How to use the arrangekeys.default function in arrangekeys

To help you get started, we’ve selected a few arrangekeys 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 / boundation / source / package.js View on Github external
scripts[prefix] = false
					merge[key] = prefix
					list.add(prefix)
				}
			}
		}
	}

	// perform the alpha sort, with my: scripts first, then our: scripts, then everything else
	const myScripts = Array.from(list)
		.filter(key => key.startsWith('my:'))
		.sort()
	const ourScripts = Array.from(list)
		.filter(key => key.startsWith('our:'))
		.sort()
	scripts = arrangekeys(scripts, myScripts.concat(ourScripts))

	// use new order, to merge scripts into a set, to prevent duplicates
	const sortedList = Object.keys(scripts)
	for (const key of sortedList) {
		const prefix = merge[key]
		// check if this key is one that is to be merged
		if (prefix) {
			const value = scripts[prefix] || false
			if (typeof value === 'string') {
				// ignore, keep the user override
			} else {
				if (!value) scripts[prefix] = new Set()
				scripts[prefix].add(`${state.answers.packageManager} run ${key}`)
			}
		}
	}
github bevry / boundation / source / package.js View on Github external
// set travisTLD if it is com
	// we don't set it explicity to org
	// so that when the official migration happens, there will be no manual changes
	if (
		packageData.badges.list.includes('travisci') &&
		state.travisTLD === 'com'
	) {
		packageData.badges.config.travisTLD = state.travisTLD
	}

	// ---------------------------------
	// Arrange

	// package keys
	packageData = arrangekeys(
		packageData,
		'title name version private description homepage license keywords badges funding author sponsors maintainers contributors bugs repository engines editions bin types type main browser module jspm dependencies optionalDependencies devDependencies peerDependencies scripts now eslintConfig prettier babel'
	)

	// ---------------------------------
	// Scripts

	// scripts
	let scripts = Object.assign({}, state.userScripts, state.scripts)

	// merge in editions[].scripts
	Object.assign(
		scripts,
		...activeEditions.map(edition => edition.scripts || {})
	)
github bevry / boundation / source / package.js View on Github external
packageData.editions = activeEditions.map(function(edition) {
			const result = arrangekeys(
				edition,
				'description directory entry tags engines'
			)
			if (result.tags) result.tags = Array.from(result.tags.values())
			return result
		})
	} else {

arrangekeys

Returns a copy of a JavaScript object with the keys arranged in a specified order. Useful for formatting JSON files.

Artistic-2.0
Latest version published 11 months ago

Package Health Score

63 / 100
Full package analysis

Popular arrangekeys functions