repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/argument.required.test.js | tests/argument.required.test.js | const commander = require('../');
// Low-level tests of setting Argument.required.
// Higher level tests of optional/required arguments elsewhere.
test('when name with surrounding <> then argument required', () => {
const argument = new commander.Argument('<name>');
expect(argument.required).toBe(true);
});
test... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.executableSubcommand.lookup.test.js | tests/command.executableSubcommand.lookup.test.js | const childProcess = require('child_process');
const path = require('path');
const util = require('util');
const execFileAsync = util.promisify(childProcess.execFile);
// Calling node explicitly so pm works without file suffix cross-platform.
// This file does end-to-end tests actually spawning program.
// See also co... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.exitOverride.test.js | tests/command.exitOverride.test.js | const commander = require('../');
const path = require('path');
// Test details of the exitOverride errors.
// The important checks are the exitCode and code which are intended to be stable for
// semver minor versions. For now, also testing the error.message and that output occurred
// to detect accidental changes in... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.usage.test.js | tests/command.usage.test.js | const commander = require('../');
test('when default usage and check program help then starts with default usage', () => {
const program = new commander.Command();
program.name('test');
const helpInformation = program.helpInformation();
expect(helpInformation).toMatch(/^Usage: test \[options\]/);
});
test('... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.padWidth.test.js | tests/help.padWidth.test.js | const commander = require('../');
// These are tests of the Help class, not of the Command help.
// There is some overlap with the higher level Command tests (which predate Help).
describe('padWidth', () => {
test('when argument term longest return argument length', () => {
const longestThing = 'veryLongThingBi... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/args.variadic.test.js | tests/args.variadic.test.js | const commander = require('../');
// Testing variadic arguments. Testing all the action arguments, but could test just variadicArg.
describe('variadic argument', () => {
test('when no extra arguments specified for program then variadic arg is empty array', () => {
const actionMock = jest.fn();
const program... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.mandatory.test.js | tests/options.mandatory.test.js | const commander = require('../');
// Assuming mandatory options behave as normal options apart from the mandatory aspect, not retesting all behaviour.
// Likewise, not redoing all tests on subcommand after testing on program.
describe('required program option with mandatory value specified', () => {
test('when prog... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.createArgument.test.js | tests/command.createArgument.test.js | const commander = require('../');
class MyArgument extends commander.Argument {
constructor(name, description) {
super(name, description);
this.myProperty = 'MyArgument';
}
}
class MyCommand extends commander.Command {
createArgument(name, description) {
return new MyArgument(name, description);
}... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.longestArgumentTermLength.test.js | tests/help.longestArgumentTermLength.test.js | const commander = require('../');
// These are tests of the Help class, not of the Command help.
// There is some overlap with the higher level Command tests (which predate Help).
describe('longestArgumentTermLength', () => {
test('when no arguments then returns zero', () => {
const program = new commander.Comm... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.choices.test.js | tests/options.choices.test.js | const commander = require('../');
test('when option argument in choices then option set', () => {
const program = new commander.Command();
program
.exitOverride()
.addOption(
new commander.Option('--colour <shade>').choices(['red', 'blue']),
);
program.parse(['--colour', 'red'], { from: 'user' ... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.longestCommandTermLength.test.js | tests/help.longestCommandTermLength.test.js | const commander = require('../');
// These are tests of the Help class, not of the Command help.
// There is some overlap with the higher level Command tests (which predate Help).
describe('longestSubcommandTermLength', () => {
test('when no commands then returns zero', () => {
const program = new commander.Com... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.summary.test.js | tests/command.summary.test.js | const commander = require('../');
test('when set summary then get summary', () => {
const program = new commander.Command();
const summary = 'abcdef';
program.summary(summary);
expect(program.summary()).toMatch(summary);
});
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.default.test.js | tests/options.default.test.js | const { Command, Option } = require('../');
describe('.option() with default and option not specified in parse', () => {
test('when boolean option with boolean default then value is default', () => {
const program = new Command();
program.option('-d, --debug', 'description', false);
program.parse([], { f... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.commandHelp.test.js | tests/command.commandHelp.test.js | const commander = require('../');
// This is a ported legacy test.
test('when program has command then appears in help', () => {
const program = new commander.Command();
program.command('bare');
const commandHelp = program.helpInformation();
expect(commandHelp).toMatch(/Commands:\n +bare\n/);
});
test('when ... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.allowExcessArguments.test.js | tests/command.allowExcessArguments.test.js | const commander = require('../');
// Not testing output, just testing whether an error is detected.
describe.each([true, false])(
'allowExcessArguments when action handler: %s',
(hasActionHandler) => {
function configureCommand(cmd) {
cmd.exitOverride().configureOutput({
writeErr: () => {},
... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.optional.test.js | tests/options.optional.test.js | const commander = require('../');
// option with optional value, no default
describe('option with optional value, no default', () => {
test('when option not specified then value is undefined', () => {
const program = new commander.Command();
program.option('--cheese [type]', 'cheese type');
program.parse... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.required.test.js | tests/options.required.test.js | const commander = require('../');
// option with required value, no default
describe('option with required value, no default', () => {
test('when option not specified then value is undefined', () => {
const program = new commander.Command();
program.option('--cheese <type>', 'cheese type');
program.parse... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.unknownCommand.test.js | tests/command.unknownCommand.test.js | const commander = require('../');
describe('unknownCommand', () => {
// Optional. Use internal knowledge to suppress output to keep test output clean.
let writeErrorSpy;
beforeAll(() => {
writeErrorSpy = jest
.spyOn(process.stderr, 'write')
.mockImplementation(() => {});
});
afterEach(() =>... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.optionDescription.test.js | tests/help.optionDescription.test.js | const commander = require('../');
// These are tests of the Help class, not of the Command help.
// There is some overlap with the higher level Command tests (which predate Help).
describe('optionDescription', () => {
test('when option has no description then empty string', () => {
const option = new commander.... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.argumentVariations.test.js | tests/command.argumentVariations.test.js | const commander = require('../');
// Do some low-level checks that the multiple ways of specifying command arguments produce same internal result,
// and not exhaustively testing all methods elsewhere.
test.each(getSingleArgCases('<explicit-required>'))(
'when add "<arg>" using %s then argument required',
(method... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/argument.custom-processing.test.js | tests/argument.custom-processing.test.js | const commander = require('../');
// Testing default value and custom processing behaviours.
// Some double assertions in tests to check action argument and .processedArg
test('when argument not specified then callback not called', () => {
const mockCoercion = jest.fn();
const program = new commander.Command();
... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.commandTerm.test.js | tests/help.commandTerm.test.js | const commander = require('../');
// These are tests of the Help class, not of the Command help.
// There is some overlap with the higher level Command tests (which predate Help).
// subcommandTerm does not currently respect helpOption or ignore hidden options, so not testing those.
describe('subcommandTerm', () => {... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.helpOption.test.js | tests/command.helpOption.test.js | const commander = require('../');
describe('helpOption', () => {
let writeSpy;
let writeErrorSpy;
beforeAll(() => {
// Optional. Suppress expected output to keep test output clean.
writeSpy = jest.spyOn(process.stdout, 'write').mockImplementation(() => {});
writeErrorSpy = jest
.spyOn(process.... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.showHelpAfterError.test.js | tests/command.showHelpAfterError.test.js | const commander = require('../');
describe('showHelpAfterError with message', () => {
const customHelpMessage = 'See --help';
function makeProgram() {
const writeMock = jest.fn();
const program = new commander.Command();
program
.exitOverride()
.showHelpAfterError(customHelpMessage)
... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.registerClash.test.js | tests/options.registerClash.test.js | const { Command, Option } = require('../');
describe('.option()', () => {
test('when short option flag conflicts then throws', () => {
expect(() => {
const program = new Command();
program
.option('-c, --cheese <type>', 'cheese type')
.option('-c, --conflict');
}).toThrow('Cannot ... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.variadic.test.js | tests/options.variadic.test.js | const commander = require('../');
describe('variadic option with required value', () => {
test('when variadic with value missing then error', () => {
const program = new commander.Command();
program
.exitOverride()
.configureOutput({ writeErr: jest.fn() })
.option('-r,--required <value...>'... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.suggestion.test.js | tests/help.suggestion.test.js | const { Command, Option } = require('../');
// Note: setting up shared command configuration in getSuggestion,
// and looking for possible subcommand 'sub'.
function getSuggestion(program, arg) {
let message = '';
program
.showSuggestionAfterError() // make sure on
.exitOverride()
.configureOutput({
... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.showSuggestionAfterError.test.js | tests/command.showSuggestionAfterError.test.js | const { Command } = require('../');
function getSuggestion(program, arg) {
let message = '';
program.exitOverride().configureOutput({
writeErr: (str) => {
message = str;
},
});
try {
program.parse([arg], { from: 'user' });
} catch (err) {
/* empty */
}
const match = message.match(... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/incrementNodeInspectorPort.test.js | tests/incrementNodeInspectorPort.test.js | const childProcess = require('child_process');
const path = require('path');
const commander = require('../');
describe('incrementNodeInspectorPort', () => {
let spawnSpy;
let signalSpy;
const oldExecArgv = process.execArgv;
beforeAll(() => {
spawnSpy = jest.spyOn(childProcess, 'spawn').mockImplementation... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.help.test.js | tests/command.help.test.js | const commander = require('../');
// Testing various help incantations.
//
// Note there are also specific help tests included in many of the feature tests,
// such as the alias, version, usage, name, helpOption, and commandHelp tests.
// Avoid doing many full format tests as will be broken by any layout changes!
tes... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.sortOptions.test.js | tests/help.sortOptions.test.js | const commander = require('../');
// These are tests of the Help class, not of the Command help.
// There is some overlap with the higher level Command tests (which predate Help).
describe('sortOptions', () => {
test('when unsorted then options in order added', () => {
const program = new commander.Command();
... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/argument.chain.test.js | tests/argument.chain.test.js | const { Argument } = require('../');
describe('Argument methods that should return this for chaining', () => {
test('when call .default() then returns this', () => {
const argument = new Argument('<value>');
const result = argument.default(3);
expect(result).toBe(argument);
});
test('when call .argP... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.longestOptionTermLength.test.js | tests/help.longestOptionTermLength.test.js | const commander = require('../');
// These are tests of the Help class, not of the Command help.
// There is some overlap with the higher level Command tests (which predate Help).
describe('longestOptionTermLength', () => {
test('when no option then returns zero', () => {
const program = new commander.Command()... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.copySettings.test.js | tests/command.copySettings.test.js | const commander = require('../');
// Tests some private properties as simpler than pure tests of observable behaviours.
// Testing before and after values in some cases, to ensure value actually changes (when copied).
test('when add subcommand with .command() then calls copyInheritedSettings from parent', () => {
c... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.argumentDescription.test.js | tests/help.argumentDescription.test.js | const commander = require('../');
// These are tests of the Help class, not of the Command help.
describe('argumentDescription', () => {
test('when argument has no description then empty string', () => {
const argument = new commander.Argument('[n]');
const helper = new commander.Help();
expect(helper.a... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.bool.combo.test.js | tests/options.bool.combo.test.js | const commander = require('../');
// Test combination of flag and --no-flag
// (single flags tested in options.bool.test.js)
// boolean option combo with no default
describe('boolean option combo with no default', () => {
function createPepperProgram() {
const program = new commander.Command();
program
... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/fixtures/pm-fail.js | tests/fixtures/pm-fail.js | process.exit(42);
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/fixtures/pm-cache.js | tests/fixtures/pm-cache.js | const { program } = require('../../');
program
.command('clear', 'clear the cache')
.command('validate', 'validate the cache', { isDefault: true })
.parse(process.argv);
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/fixtures/inspect.js | tests/fixtures/inspect.js | #!/usr/bin/env node
const { program } = require('../../');
process.env.FORCE_COLOR = 0; // work-around bug in Jest: https://github.com/jestjs/jest/issues/14391
program.command('sub', 'install one or more packages').parse(process.argv);
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/fixtures/pm-cache-clear.js | tests/fixtures/pm-cache-clear.js | console.log('cache-clear');
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/fixtures/pm-publish.js | tests/fixtures/pm-publish.js | console.log('publish');
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/fixtures/inspect-sub.js | tests/fixtures/inspect-sub.js | console.log(process.execArgv);
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/fixtures/pm-cache-validate.js | tests/fixtures/pm-cache-validate.js | console.log('cache-validate');
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/fixtures/pm-terminate.js | tests/fixtures/pm-terminate.js | process.kill(process.pid, 'SIGINT');
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/fixtures/pm-echo.js | tests/fixtures/pm-echo.js | console.log(process.argv.slice(2));
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/fixtures-extensions/pm.js | tests/fixtures-extensions/pm.js | #!/usr/bin/env node
const { program } = require('../../');
program
.command('try-ts', 'test file extension lookup')
.command('try-cjs', 'test file extension lookup')
.command('try-mjs', 'test file extension lookup')
.parse(process.argv);
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/action-this.js | examples/action-this.js | #!/usr/bin/env node
// This example is used as an example in the README for the action handler.
const { Command } = require('commander');
const program = new Command();
program
.command('serve')
.argument('<script>')
.option('-p, --port <number>', 'port number', 80)
.action(function () {
console.error('R... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/configure-help.js | examples/configure-help.js | const commander = require('commander');
const program = new commander.Command();
// This example shows a simple use of configureHelp.
// This is used as an example in the README.
// Any method on the Help class can be overridden
// See: https://github.com/tj/commander.js/blob/master/lib/help.js
program.configureHelp(... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-implies.js | examples/options-implies.js | #!/usr/bin/env node
const { Command, Option } = require('commander');
const program = new Command();
program
.addOption(new Option('--quiet').implies({ logLevel: 'off' }))
.addOption(
new Option('--log-level <level>')
.choices(['info', 'warning', 'error', 'off'])
.default('info'),
)
.addOption(... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/pm-list.js | examples/pm-list.js | #!/usr/bin/env node
console.log('list');
| javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/custom-command-class.js | examples/custom-command-class.js | #!/usr/bin/env node
const commander = require('commander');
// Use a class override to customise the command and its subcommands.
class CommandWithTrace extends commander.Command {
createCommand(name) {
const cmd = new CommandWithTrace(name);
// Add an option to subcommands created using `.command()`
cm... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/global-options-added.js | examples/global-options-added.js | #!/usr/bin/env node
// This example shows a couple of ways to add a "global" option to all of the subcommands.
// The first approach is to use a subclass and add the option as the subcommand is created.
// The second approach is to loop over the subcommands after they have been created.
//
// The code in this example ... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/hook.js | examples/hook.js | #!/usr/bin/env node
const { Command, Option } = require('commander');
const program = new Command();
// This example shows using some hooks for life cycle events.
const timeLabel = 'command duration';
program
.option('--profile', 'show how long command takes')
.hook('preAction', (thisCommand) => {
if (thisCo... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-variadic.js | examples/options-variadic.js | #!/usr/bin/env node
// This is used as an example in the README for variadic options.
const commander = require('commander');
const program = new commander.Command();
program
.option('-n, --number <value...>', 'specify numbers')
.option('-l, --letter [value...]', 'specify letters');
program.parse();
console.lo... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/help-groups.js | examples/help-groups.js | const { Command, Option } = require('commander');
// Show the two approaches for adding help groups, and how to customise the built-in help and version.
const program = new Command();
const devOptionsHeading = 'Development Options:';
const managementCommandsHeading = 'Management Commands:';
// The high-level approac... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-env.js | examples/options-env.js | #!/usr/bin/env node
const { Command, Option } = require('commander');
const program = new Command();
program.addOption(
new Option('-p, --port <number>', 'specify port number')
.default(80)
.env('PORT'),
);
program.addOption(
new Option('-c, --colour', 'turn on colour output').env('COLOUR'),
);
program.add... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/global-options-nested.js | examples/global-options-nested.js | #!/usr/bin/env node
// This example shows global options on the program which affect all the subcommands.
// See how to work with global options in the subcommand and display them in the help.
//
// (A different pattern for a "global" option is to add it to the subcommands, rather
// than to the program. See global-op... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/thank.js | examples/thank.js | #!/usr/bin/env node
// This example is used as an example in the README for the action handler.
const { Command } = require('commander');
const program = new Command();
program
.argument('<name>')
.option('-t, --title <honorific>', 'title to use before name')
.option('-d, --debug', 'display some debugging')
... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/arguments-extra.js | examples/arguments-extra.js | #!/usr/bin/env node
// This is used as an example in the README for extra argument features.
const commander = require('commander');
const program = new commander.Command();
program
.addArgument(
new commander.Argument('<drink-size>', 'drink cup size').choices([
'small',
'medium',
'large',
... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-extra.js | examples/options-extra.js | #!/usr/bin/env node
// This is used as an example in the README for extra option features.
// See also options-env.js for more extensive env examples,
// and options-conflicts.js for more details about .conflicts().
const { Command, Option } = require('commander');
const program = new Command();
program
.addOption... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-required.js | examples/options-required.js | #!/usr/bin/env node
// This is used as an example in the README for:
// Required option
// You may specify a required (mandatory) option using `.requiredOption`.
// The option must be specified on the command line, or by having a default value.
const commander = require('commander');
const program = new comm... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/argument.js | examples/argument.js | #!/usr/bin/env node
// This example shows specifying the command arguments using argument() function.
const { Command } = require('commander');
const program = new Command();
program
.name('connect')
.argument('<server>', 'connect to the specified server')
.argument('[user]', 'user account for connection', 'gu... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/positional-options.js | examples/positional-options.js | #!/usr/bin/env node
const { Command } = require('commander');
const program = new Command();
program.enablePositionalOptions().option('-p, --progress');
program
.command('upload <file>')
.option('-p, --port <number>', 'port number', 80)
.action((file, options) => {
if (program.opts().progress) console.log(... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-custom-processing.js | examples/options-custom-processing.js | #!/usr/bin/env node
// This is used as an example in the README for:
// Custom option processing
// You may specify a function to do custom processing of option values.
const commander = require('commander');
const program = new commander.Command();
function myParseInt(value) {
// parseInt takes a string and... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/help-subcommands-usage.js | examples/help-subcommands-usage.js | const commander = require('commander');
// By default the subcommand list includes a fairly simple usage. If you have added a custom usage
// to the subcommands you may wish to configure the help to show these instead.
//
// See also ./configure-help.js which shows configuring the subcommand list to have no usage at a... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/string-util.js | examples/string-util.js | const { Command } = require('commander');
const program = new Command();
// This is used as an example in the README for the Quick Start.
program
.name('string-util')
.description('CLI to some JavaScript string utilities')
.version('0.8.0');
program
.command('split')
.description('Split a string into subst... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/defaultCommand.js | examples/defaultCommand.js | #!/usr/bin/env node
const commander = require('commander');
const program = new commander.Command();
// Example program using the command configuration option isDefault to specify the default command.
program
.command('build')
.description('build web site for deployment')
.action(() => {
console.log('build... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-conflicts.js | examples/options-conflicts.js | #!/usr/bin/env node
const { Command, Option } = require('commander');
const program = new Command();
// You can use .conflicts() with a single string, which is the camel-case name of the conflicting option.
program
.command('pay')
.addOption(new Option('--cash').conflicts('creditCard'))
.addOption(new Option('--... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-boolean-or-value.js | examples/options-boolean-or-value.js | #!/usr/bin/env node
// This is used as an example in the README for:
// Other option types, flag|value
// You can specify an option which functions as a flag but may also take a value (declared using square brackets).
const commander = require('commander');
const program = new commander.Command();
program.opti... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/custom-help-text.js | examples/custom-help-text.js | #!/usr/bin/env node
// This example shows using addHelpText.
const { Command } = require('commander');
const program = new Command();
program.name('awesome');
program
.addHelpText('beforeAll', 'A W E S O M E\n')
.addHelpText('afterAll', (context) => {
if (context.error) {
return '\nHelp being displaye... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-negatable.js | examples/options-negatable.js | #!/usr/bin/env node
// This is used as an example in the README for:
// Other option types, negatable boolean
// You can specify a boolean option long name with a leading `no-` to make it true by default and able to be negated.
const commander = require('commander');
const program = new commander.Command();
pr... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-common.js | examples/options-common.js | #!/usr/bin/env node
// This is used as an example in the README for:
// Common option types, boolean and value
const commander = require('commander');
const program = new commander.Command();
program
.option('-d, --debug', 'output extra debugging')
.option('-s, --small', 'small pizza size')
.option('-p, --p... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/options-defaults.js | examples/options-defaults.js | #!/usr/bin/env node
// This is used as an example in the README for:
// Default option value
const commander = require('commander');
const program = new commander.Command();
program.option(
'-c, --cheese <type>',
'Add the specified type of cheese',
'blue',
);
program.parse();
console.log(`cheese: ${progra... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/alias.js | examples/alias.js | #!/usr/bin/env node
// This example shows giving alternative names for a command.
const { Command } = require('commander');
const program = new Command();
program
.command('exec')
.argument('<script>')
.alias('ex')
.action((script) => {
console.log(`execute: ${script}`);
});
program
.command('print'... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/pass-through-options.js | examples/pass-through-options.js | #!/usr/bin/env node
const { Command } = require('commander');
const program = new Command();
program
.argument('<utility>')
.argument('[args...]')
.passThroughOptions()
.option('-d, --dry-run')
.action((utility, args, options) => {
const action = options.dryRun ? 'Would run' : 'Running';
console.log... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/configure-output.js | examples/configure-output.js | const commander = require('commander');
const program = new commander.Command();
function errorColor(str) {
// Add ANSI escape codes to display text in red.
return `\x1b[31m${str}\x1b[0m`;
}
program.configureOutput({
// Visibly override write routines as example!
writeOut: (str) => process.stdout.write(`[OUT]... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/split.js | examples/split.js | const { program } = require('commander');
// This is used as an example in the README for the Quick Start.
program.option('--first').option('-s, --separator <char>').argument('<string>');
program.parse();
const options = program.opts();
const limit = options.first ? 1 : undefined;
console.log(program.args[0].split(... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/nestedCommands.js | examples/nestedCommands.js | #!/usr/bin/env node
const commander = require('commander');
const program = new commander.Command();
// Commander supports nested subcommands.
// .command() can add a subcommand with an action handler or an executable.
// .addCommand() adds a prepared command with an action handler.
// Add nested commands using `.co... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/examples/arguments-custom-processing.js | examples/arguments-custom-processing.js | #!/usr/bin/env node
// This is used as an example in the README for:
// Custom argument processing
// You may specify a function to do custom processing of argument values.
const commander = require('commander');
const program = new commander.Command();
function myParseInt(value) {
// parseInt takes a string... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/lib/help.js | lib/help.js | const { humanReadableArgName } = require('./argument.js');
/**
* TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS`
* https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types
* @typedef { import("./argument.js").Argument } Argument... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/lib/error.js | lib/error.js | /**
* CommanderError class
*/
class CommanderError extends Error {
/**
* Constructs the CommanderError class
* @param {number} exitCode suggested exit code which could be used with process.exit
* @param {string} code an id string representing the error
* @param {string} message human-readable descriptio... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/lib/argument.js | lib/argument.js | const { InvalidArgumentError } = require('./error.js');
class Argument {
/**
* Initialize a new command argument with the given name and description.
* The default is that the argument is required, and you can explicitly
* indicate this with <> around the name. Put [] around the name for an optional argumen... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/lib/option.js | lib/option.js | const { InvalidArgumentError } = require('./error.js');
class Option {
/**
* Initialize a new `Option` with the given `flags` and `description`.
*
* @param {string} flags
* @param {string} [description]
*/
constructor(flags, description) {
this.flags = flags;
this.description = description ... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/lib/suggestSimilar.js | lib/suggestSimilar.js | const maxDistance = 3;
function editDistance(a, b) {
// https://en.wikipedia.org/wiki/Damerau–Levenshtein_distance
// Calculating optimal string alignment distance, no substring is edited more than once.
// (Simple implementation.)
// Quick early exit, return worst case.
if (Math.abs(a.length - b.length) > ... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | false |
tj/commander.js | https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/lib/command.js | lib/command.js | const EventEmitter = require('node:events').EventEmitter;
const childProcess = require('node:child_process');
const path = require('node:path');
const fs = require('node:fs');
const process = require('node:process');
const { Argument, humanReadableArgName } = require('./argument.js');
const { CommanderError } = requir... | javascript | MIT | 0692be58103e1ea8052d5d45ab11cc02e197eea5 | 2026-01-04T15:02:25.844440Z | true |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/underscore-esm-min.js | underscore-esm-min.js | // Underscore.js 1.13.7
// https://underscorejs.org
// (c) 2009-2024 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
var VERSION="1.13.7",root="object"==typeof self&&self.self===self&&self||"object"... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/karma.conf-sauce.js | karma.conf-sauce.js | var _ = require('./');
// Browsers to run on Sauce Labs platforms
// (See https://saucelabs.com/platform/supported-browsers-devices for an
// up-to-date overview of supported versions of browsers and platforms.)
var sauceBrowsers = _.reduce([
['firefox', 'latest'],
['firefox', '60'],
['firefox', '40'],
['firef... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/rollup.config2.js | rollup.config2.js | import { resolve } from 'path';
import { monolithConf } from './rollup.common.js';
var sharedInput = './underscore-node-f-pre.js';
var sharedOutput = './underscore-node-f.cjs';
export default [
// ESM entry point for Node.js 12+.
{
input: 'underscore-node-mjs-pre.js',
external: sharedInput,
output: mo... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/underscore.js | underscore.js | (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define('underscore', factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {
var current = global.... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | true |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/underscore-umd.js | underscore-umd.js | (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define('underscore', factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {
var current = global.... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | true |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/karma.conf.js | karma.conf.js | // Note some browser launchers should be installed before using karma start.
// For example:
// $ npm install karma-firefox-launcher
// $ karma start --browser=Firefox
// See https://karma-runner.github.io/0.8/config/configuration-file.html
module.exports = function(config) {
config.set({
basePath: ''... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/underscore-esm.js | underscore-esm.js | // Underscore.js 1.13.7
// https://underscorejs.org
// (c) 2009-2024 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
// Current version.
var VERSION = '1.13.7';
// Establish the root object, `wind... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | true |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/underscore-min.js | underscore-min.js | !function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n="undefined"!=typeof globalThis?globalThis:n||self,function(){var t=n._,e=n._=r();e.noConflict=function(){return n._=t,e}}())}(this,(function(){
// Underscore.js 1.13... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/rollup.config.js | rollup.config.js | import glob from 'glob';
import { filter } from './underscore-esm.js';
import { outputConf, sourcemapConf, monolithConf } from './rollup.common.js';
export default [
// Monolithic ESM bundle for browsers and deno.
{
input: 'modules/index-all.js',
treeshake: false,
output: monolithConf({
file: 'un... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/rollup.common.js | rollup.common.js | import { readFileSync } from 'fs';
import { extend } from './underscore-esm.js';
var intro = readFileSync('modules/index.js', 'utf-8').split('\n').slice(3, 7).join('\n');
var outputBase = {
strict: false,
externalLiveBindings: false,
freeze: false,
};
var sourcemapBase = {
sourcemap: true,
sourcemapExclude... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/underscore-umd-min.js | underscore-umd-min.js | !function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n="undefined"!=typeof globalThis?globalThis:n||self,function(){var t=n._,e=n._=r();e.noConflict=function(){return n._=t,e}}())}(this,(function(){
// Underscore.js 1.13... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/test/overrides.js | test/overrides.js | (function() {
function overrideDataView() {
NativeDataView = DataView;
DataView = {};
}
// Only override browser functions roughly 1/3rd of the time
var runOverrides = Math.floor(Math.random() * 3) === 0;
if (runOverrides) {
overrideDataView();
}
})();
| javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/test/cross-document.js | test/cross-document.js | (function() {
if (typeof document == 'undefined') return;
var _ = typeof require == 'function' ? require('..') : window._;
QUnit.module('Cross Document');
/* global iObject, iElement, iArguments, iFunction, iArray, iError, iString, iNumber, iBoolean, iDate, iRegExp, iNaN, iNull, iUndefined, ActiveXObject */
... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/test/collections.js | test/collections.js | (function() {
var _ = typeof require == 'function' ? require('..') : window._;
QUnit.module('Collections');
QUnit.test('each', function(assert) {
_.each([1, 2, 3], function(num, i) {
assert.strictEqual(num, i + 1, 'each iterators provide value and iteration count');
});
var answers = [];
... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | true |
jashkenas/underscore | https://github.com/jashkenas/underscore/blob/0d820ef7292cdec28dd8b5d565921b8100ca3397/test/utility.js | test/utility.js | (function() {
var _ = typeof require == 'function' ? require('..') : window._;
var templateSettings;
QUnit.module('Utility', {
beforeEach: function() {
templateSettings = _.clone(_.templateSettings);
},
afterEach: function() {
_.templateSettings = templateSettings;
}
});
if (t... | javascript | MIT | 0d820ef7292cdec28dd8b5d565921b8100ca3397 | 2026-01-04T15:02:30.228892Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.