diff --git a/README.md b/README.md index 3c0c050..06f8d03 100644 --- a/README.md +++ b/README.md @@ -114,27 +114,32 @@ esm myLib:showParams param1 param2 param3 -s --t -foo --bar -baz:42 --val=some > [ "param1", "param2", "param3", s: true, t: true, foo: true, bar: true, baz: 42, val: "some" ] ``` -Note: order don't matters... +> Note: order don't matters... You can then use ES destructuration to filter named paremeters: ```javascript -export function myAwesomeFunction( [ first, second, , forth ] ) // Array destructuration gets simple params +// Array destructuration gets simple params +export function myAwesomeFunction( [ first, second, , forth ] ) { console.log( first, second, forth ) } -export function myAwesomeFunction2( { foo, val, baz } ) // Object destructuration gets named params +// Object destructuration gets named params +export function myAwesomeFunction2( { foo, val, baz } ) { console.log( foo, val, baz ) } -export function myAwesomeFunction3( { 0:param1, 3:param4, foo, val, baz } ) // Object destructuration for both, using index name +// Object destructuration for both, using index name +export function myAwesomeFunction3( { 0:param1, 3:param4, foo, val, baz } ) { console.log( param1, param4, foo, val, baz ) } ``` -To call this kind of function in js: +To call this kind of function in js and create an augmented param array: ```javascript +import { myAwesomeFunction3 } from 'myLib' + myAwesomeFunction3({ 0: "first", 3: "forth", foo: true }) ```