CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
is-default-value.js26 linesDownload Raw Back to examples
1'use strict';2 3// This example shows how to understand if a default value is used or not.4 5// 1. const { parseArgs } = require('node:util'); // from node6// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package7const { parseArgs } = require('..'); // in repo8 9const options = {10  file: { short: 'f', type: 'string', default: 'FOO' },11};12 13const { values, tokens } = parseArgs({ options, tokens: true });14 15const isFileDefault = !tokens.some((token) => token.kind === 'option' &&16 token.name === 'file'17);18 19console.log(values);20console.log(`Is the file option [${values.file}] the default value? ${isFileDefault}`);21 22// Try the following:23//    node is-default-value.js24//    node is-default-value.js -f FILE25//    node is-default-value.js --file FILE26 
basant307/AI_Governance_Project · CoolFace