📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

commist

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commist - npm Package Compare versions

Comparing version

to
2.0.0

.github/workflows/ci.yml

9

example.js

@@ -0,7 +1,6 @@

'use strict'
var program = require('./')()
var minimist = require('minimist')
var result
result = program
const program = require('./')()
const minimist = require('minimist')
const result = program
.register('abcd', function (args) {

@@ -8,0 +7,0 @@ console.log('just do', args)

/*
The MIT License (MIT)
Copyright (c) 2014 Matteo Collina
Copyright (c) 2014-2021 Matteo Collina

@@ -27,6 +27,6 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

var leven = require('leven')
const leven = require('leven')
function commist () {
var commands = []
const commands = []

@@ -52,3 +52,3 @@ function lookup (array) {

function parse (args) {
var matching = lookup(args)
const matching = lookup(args)

@@ -66,3 +66,3 @@ if (matching.length > 0) {

function register (inputCommand, func) {
var commandOptions = {
let commandOptions = {
command: inputCommand,

@@ -77,3 +77,3 @@ strict: false,

var matching = lookup(commandOptions.command)
const matching = lookup(commandOptions.command)

@@ -80,0 +80,0 @@ matching.forEach(function (match) {

{
"name": "commist",
"version": "1.1.0",
"version": "2.0.0",
"description": "Build your commands on minimist!",

@@ -21,3 +21,3 @@ "main": "index.js",

"dependencies": {
"leven": "^2.1.0",
"leven": "^3.1.0",
"minimist": "^1.1.0"

@@ -28,5 +28,5 @@ },

"pre-commit": "^1.0.0",
"standard": "^12.0.1",
"tape": "^4.0.0"
"standard": "^16.0.0",
"tape": "^5.0.0"
}
}

@@ -0,5 +1,6 @@

'use strict'
var test = require('tape').test
const test = require('tape').test
var commist = require('./')
const commist = require('./')

@@ -9,6 +10,4 @@ test('registering a command', function (t) {

var program = commist()
const program = commist()
var result
program.register('hello', function (args) {

@@ -18,3 +17,3 @@ t.deepEqual(args, ['a', '-x', '23'])

result = program.parse(['hello', 'a', '-x', '23'])
const result = program.parse(['hello', 'a', '-x', '23'])

@@ -27,3 +26,3 @@ t.notOk(result, 'must return null, the command have been handled')

var program = commist()
const program = commist()

@@ -44,3 +43,3 @@ program.register('hello', function (args) {

var program = commist()
const program = commist()

@@ -61,3 +60,3 @@ program.register('hello', function (args) {

var program = commist()
const program = commist()

@@ -78,3 +77,3 @@ program.register('hello', function (args) {

var program = commist()
const program = commist()

@@ -93,3 +92,3 @@ program.register('hello', function (args) {

test('registering ambiguous commands throws exception', function (t) {
var program = commist()
const program = commist()

@@ -112,3 +111,3 @@ function noop () {}

test('looking up commands', function (t) {
var program = commist()
const program = commist()

@@ -131,3 +130,3 @@ function noop1 () {}

test('looking up commands with abbreviations', function (t) {
var program = commist()
const program = commist()

@@ -150,3 +149,3 @@ function noop1 () {}

test('looking up strict commands', function (t) {
var program = commist()
const program = commist()

@@ -169,3 +168,3 @@ function noop1 () {}

var program = commist()
const program = commist()

@@ -184,3 +183,3 @@ program.register('hello', function (args) {

test('a command must be at least 3 chars', function (t) {
var program = commist()
const program = commist()

@@ -199,3 +198,3 @@ function noop1 () {}

test('a command part must be at least 3 chars', function (t) {
var program = commist()
const program = commist()

@@ -202,0 +201,0 @@ function noop1 () {}