Gathering detailed insights and metrics for @debonet/es6format
Gathering detailed insights and metrics for @debonet/es6format
Gathering detailed insights and metrics for @debonet/es6format
Gathering detailed insights and metrics for @debonet/es6format
String formatting that replicates the ES6 template operator but executes at runtime.
npm install @debonet/es6format
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
3 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Aug 13, 2022
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
@debonet/es6format@1.0.1
Unpacked Size
5.32 kB
Size
2.56 kB
File Count
4
NPM Version
8.15.0
Node Version
18.7.0
Cumulative downloads
Total Downloads
No dependencies detected.
String formatting that replicates the ES6 template operator but executes at runtime.
1 npm install es6format
1 const format = require( "es6format" ); 2 console.log( 3 format( "Hello, ${0}!", "World" ) 4 ); 5 // output: Hello, World! 6 7 format.bindTo( String, 'using' ); 8 console.log( 9 "Hello, ${0}!".using( "World" ) 10 ); 11 // output: Hello, World!
Usage is straightforward:
1 format( <template-string>, ...args )
Arguments passed to the function are made available to the template via the following ways:
${0}
to reference arugments by order
1 format( "Hello, ${0}!", "World" );
${name}
to reference any fields of arguments
1 format( "Call me ${name}.", { name : "Ishmael" });
NOTE: in cases where multiple arguments include the same field, the last argument takes precidence. Use fully defined object references to get access to the others. See below
1 format( 2 "Don't call me ${name}.", 3 { name : "Ishmael" }, 4 { name : "Bob"} 5 );
${arg1}
to use arguments within expressions or to access argument fields. Particularly handy to disambiguate fields when multiple arguments have them (e.g. ${arg2.name}
)
1 format( 2 "Using ${name} gives you ${arg1.name} not ${arg0.name}", 3 { name : "Ishmael" }, 4 { name : "Bob"} 5 );
to use the argument in a function
1 format( "B is letter ${arg0.indexOf('B')} letter", "ABC" );
${a + b}
1 format( "the sum of ${a} and ${b} is ${a + b}", {a: 2, b: 5} );
${arg3.method()}
1 format( "Please don't ${arg0.toLowerCase()}", "YELL" );
${args[3]}
to reference arugments programatically (e.g. ${args[arg0]})
1 format( "I am ${args[arg0]}", 1, "right", "wrong" )
${x=3}
to set values for use later in the format string (e.g. ${x=a+3})
1 format( 2 "${arg0}^2 is ${x=arg0*arg0}, and squared again is ${x*x}", 3 3 4 )
${ ...some computation }
or ${ ...some computation, 'output' }
1 format( 2 "my favorite mice are ${ args.join(' mouse, ') }", 3 "Mickey", "Minie", "Mighty" 4 )
and
1 format( 2 "the password is a ${ arg0.substring( arg0.indexOf( '{' ) + 1, arg0.indexOf( '}' ))}", 3 "hidden{secret}within" 4 )
and
1 format( 2 "x.a is ${ x = { a : arg0 + arg1 }, 'set' } to ${x.a}", 3 2, 3 4 )
and even,
1 format( 2 "${args.reduce((o,i)=>{if (o<3) return o+i; return i})}", 3 1,2,3,4,5,6,7 4 )
es6format makes use of Function(), so it should never be called on format strings that are not known to be safe.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year