<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: ehmicky</title>
    <description>The latest articles on Forem by ehmicky (@ehmicky).</description>
    <link>https://forem.com/ehmicky</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F130754%2F8f737a5a-2538-41ed-a33f-b535f87b78e4.jpeg</url>
      <title>Forem: ehmicky</title>
      <link>https://forem.com/ehmicky</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ehmicky"/>
    <language>en</language>
    <item>
      <title>⛑ JSON serialization should never fail.</title>
      <dc:creator>ehmicky</dc:creator>
      <pubDate>Mon, 01 Aug 2022 18:22:24 +0000</pubDate>
      <link>https://forem.com/ehmicky/json-serialization-should-never-fail-a1a</link>
      <guid>https://forem.com/ehmicky/json-serialization-should-never-fail-a1a</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wCJaN0tR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/ehmicky/design/main/safe-json-value/safe-json-value.svg%3Fsanitize%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wCJaN0tR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/ehmicky/design/main/safe-json-value/safe-json-value.svg%3Fsanitize%3Dtrue" width="880" height="172"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ehmicky/safe-json-value"&gt;&lt;code&gt;safe-json-value&lt;/code&gt;&lt;/a&gt; is a JavaScript library to prevent &lt;code&gt;JSON.serialize()&lt;/code&gt; from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/ehmicky/safe-json-value#exceptions"&gt;Throwing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ehmicky/safe-json-value#unexpected-types"&gt;Changing types&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/ehmicky/safe-json-value#filtered-values"&gt;Filtering&lt;/a&gt; or &lt;a href="https://github.com/ehmicky/safe-json-value#unresolved-values"&gt;transforming values&lt;/a&gt; unexpectedly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;safeJsonValue&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;safe-json-value&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;one&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;

&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Throws due to cycle&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;changes&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;safeJsonValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// '{"one":true}"&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;changes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// List of changed properties&lt;/span&gt;
&lt;span class="c1"&gt;// [&lt;/span&gt;
&lt;span class="c1"&gt;//   {&lt;/span&gt;
&lt;span class="c1"&gt;//     path: ['self'],&lt;/span&gt;
&lt;span class="c1"&gt;//     oldValue: &amp;lt;ref *1&amp;gt; { one: true, self: [Circular *1] },&lt;/span&gt;
&lt;span class="c1"&gt;//     newValue: undefined,&lt;/span&gt;
&lt;span class="c1"&gt;//     reason: 'unsafeCycle'&lt;/span&gt;
&lt;span class="c1"&gt;//   }&lt;/span&gt;
&lt;span class="c1"&gt;// ]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>node</category>
      <category>javascript</category>
      <category>json</category>
    </item>
    <item>
      <title>Cross-platform terminal characters</title>
      <dc:creator>ehmicky</dc:creator>
      <pubDate>Mon, 29 Mar 2021 13:19:17 +0000</pubDate>
      <link>https://forem.com/ehmicky/cross-platform-terminal-characters-2gfm</link>
      <guid>https://forem.com/ehmicky/cross-platform-terminal-characters-2gfm</guid>
      <description>&lt;p&gt;While &lt;a href="https://en.wikipedia.org/wiki/ASCII"&gt;ASCII characters&lt;/a&gt; display correctly on all terminals, this is not the case of all characters. When building a terminal application or tool, it is common to experience cross-platform issues like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--usd2qjpd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/ehmicky/cross-platform-terminal-characters/main/invalid_terminal_characters.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--usd2qjpd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/ehmicky/cross-platform-terminal-characters/main/invalid_terminal_characters.png" width="259" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The main reasons are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The terminal font might not include this specific character.&lt;/li&gt;
&lt;li&gt;The terminal encoding may not support &lt;a href="https://en.wikipedia.org/wiki/Unicode"&gt;Unicode&lt;/a&gt;. For example, &lt;a href="https://en.wikipedia.org/wiki/Cmd.exe"&gt;&lt;code&gt;cmd.exe&lt;/code&gt;&lt;/a&gt; on Windows often use specific encodings like &lt;a href="https://en.wikipedia.org/wiki/Code_page_437"&gt;CP437&lt;/a&gt;, &lt;a href="https://en.wikipedia.org/wiki/Code_page_850"&gt;CP850&lt;/a&gt; or &lt;a href="https://en.wikipedia.org/wiki/Windows-1252"&gt;Windows-1252&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The application might not be properly converting encodings when reading or writing terminal characters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first two points can be solved by using characters known to display correctly on most terminals and environments.&lt;/p&gt;

&lt;p&gt;The following repository shows a full list of cross-platform terminal characters: &lt;a href="https://github.com/ehmicky/cross-platform-terminal-characters"&gt;https://github.com/ehmicky/cross-platform-terminal-characters&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Those have been tested on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ubuntu 20.10, Gnome terminal 3.38.0&lt;/li&gt;
&lt;li&gt;macOS 10.14, terminal.app 2.9&lt;/li&gt;
&lt;li&gt;Windows 10.0.17763, cmd.exe (CP850)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>terminal</category>
      <category>cli</category>
      <category>shell</category>
      <category>unicode</category>
    </item>
    <item>
      <title>Run any Node.js version</title>
      <dc:creator>ehmicky</dc:creator>
      <pubDate>Tue, 13 Aug 2019 13:06:52 +0000</pubDate>
      <link>https://forem.com/ehmicky/run-any-node-js-version-5d7j</link>
      <guid>https://forem.com/ehmicky/run-any-node-js-version-5d7j</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UkjG8-b2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/ehmicky/design/master/nve/nve.svg%3Fsanitize%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UkjG8-b2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/ehmicky/design/master/nve/nve.svg%3Fsanitize%3Dtrue" width="818" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ehmicky/nve"&gt;nve&lt;/a&gt; is a library that executes a file, command or REPL using a specific Node.js version.&lt;/p&gt;

&lt;p&gt;Unlike &lt;a href="https://github.com/nvm-sh/nvm/blob/master/README.md#usage"&gt;&lt;code&gt;nvm run&lt;/code&gt;&lt;/a&gt; it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;is &lt;a href="https://github.com/ehmicky/nve#benchmarks"&gt;10 times faster&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;does not need a separate installation step for each Node version&lt;/li&gt;
&lt;li&gt;works on Windows&lt;/li&gt;
&lt;li&gt;does not require Bash&lt;/li&gt;
&lt;li&gt;is installed as a Node module (as opposed to a &lt;a href="https://github.com/nvm-sh/nvm/blob/master/README.md#installation-and-update"&gt;Bash installation script&lt;/a&gt; downloaded with &lt;code&gt;curl&lt;/code&gt;)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Same as `node` but with Node 12&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;nve 12
Welcome to Node.js v12.8.0.
Type &lt;span class="s2"&gt;".help"&lt;/span&gt; &lt;span class="k"&gt;for &lt;/span&gt;more information.
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .exit

&lt;span class="c"&gt;# Same as `node file.js` but with Node 8&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;nve 8 file.js

&lt;span class="c"&gt;# Any Node CLI flag can be used&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;nve 8 &lt;span class="nt"&gt;--print&lt;/span&gt; &lt;span class="s1"&gt;'process.version'&lt;/span&gt;
v8.16.0

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>node</category>
      <category>javascript</category>
    </item>
    <item>
      <title>🤖 Repeat tests. Repeat tests. Repeat tests.</title>
      <dc:creator>ehmicky</dc:creator>
      <pubDate>Tue, 09 Jul 2019 14:03:23 +0000</pubDate>
      <link>https://forem.com/ehmicky/repeat-tests-repeat-tests-repeat-tests-4l39</link>
      <guid>https://forem.com/ehmicky/repeat-tests-repeat-tests-repeat-tests-4l39</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--84luUfaK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/ehmicky/design/master/test-each/test-each.svg%3Fsanitize%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--84luUfaK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/ehmicky/design/master/test-each/test-each.svg%3Fsanitize%3Dtrue" width="729" height="145"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ehmicky/test-each"&gt;&lt;code&gt;test-each&lt;/code&gt;&lt;/a&gt; is a Node.js library to repeat tests using different inputs (&lt;a href="https://en.wikipedia.org/wiki/Data-driven_testing"&gt;Data-Driven Testing&lt;/a&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;test runner independent: works with your current setup&lt;/li&gt;
&lt;li&gt;generates test titles that are descriptive, unique, for any JavaScript type (not just JSON)&lt;/li&gt;
&lt;li&gt;loops over every possible combination of inputs (cartesian product)&lt;/li&gt;
&lt;li&gt;can use random functions (fuzz testing)&lt;/li&gt;
&lt;li&gt;snapshot testing friendly&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>testing</category>
    </item>
    <item>
      <title>Gulp.js command execution for humans.</title>
      <dc:creator>ehmicky</dc:creator>
      <pubDate>Tue, 02 Jul 2019 13:32:51 +0000</pubDate>
      <link>https://forem.com/ehmicky/gulp-js-command-execution-for-humans-2idg</link>
      <guid>https://forem.com/ehmicky/gulp-js-command-execution-for-humans-2idg</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fehmicky%2Fdesign%2Fmaster%2Fgulp-execa%2Fgulp-execa.svg%3Fsanitize%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fehmicky%2Fdesign%2Fmaster%2Fgulp-execa%2Fgulp-execa.svg%3Fsanitize%3Dtrue"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Build automation in JavaScript has gotten too complicated. It's time to bring it back to simple terminal commands executed in order, using &lt;a href="https://github.com/ehmicky/gulp-execa" rel="noopener noreferrer"&gt;Gulp-execa&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As opposed to similar plugins or to &lt;a href="https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback" rel="noopener noreferrer"&gt;&lt;code&gt;child_process.exec()&lt;/code&gt;&lt;/a&gt;, this uses &lt;a href="https://github.com/sindresorhus/execa" rel="noopener noreferrer"&gt;&lt;code&gt;execa&lt;/code&gt;&lt;/a&gt; which provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/IndigoUnited/node-cross-spawn#why" rel="noopener noreferrer"&gt;Better Windows support&lt;/a&gt;, including &lt;a href="https://en.wikipedia.org/wiki/Shebang_(Unix)" rel="noopener noreferrer"&gt;shebangs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Faster and more secure commands, since &lt;a href="https://github.com/ehmicky/gulp-execa/blob/master/README.md#command" rel="noopener noreferrer"&gt;no shell is used by default&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Execution of &lt;a href="https://github.com/ehmicky/gulp-execa/blob/master/docs/API.md#preferlocal" rel="noopener noreferrer"&gt;locally installed binaries&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/sindresorhus/execa#all-1" rel="noopener noreferrer"&gt;Interleaved&lt;/a&gt; &lt;code&gt;stdout&lt;/code&gt;/&lt;code&gt;stderr&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;gulp-execa&lt;/code&gt; adds Gulp-specific features to &lt;a href="https://github.com/sindresorhus/execa" rel="noopener noreferrer"&gt;&lt;code&gt;execa&lt;/code&gt;&lt;/a&gt; including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;a href="https://github.com/ehmicky/gulp-execa/blob/master/README.md#taskcommand-options" rel="noopener noreferrer"&gt;task shortcut syntax&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;configurable &lt;a href="https://github.com/ehmicky/gulp-execa/blob/master/README.md#echo" rel="noopener noreferrer"&gt;verbosity&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/gulpjs/plugin-error" rel="noopener noreferrer"&gt;better errors&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Commands can be executed either directly or inside a &lt;a href="https://gulpjs.com/docs/en/api/src" rel="noopener noreferrer"&gt;files stream&lt;/a&gt;. In &lt;a href="https://github.com/ehmicky/gulp-execa/blob/master/README.md#streamfunction-options" rel="noopener noreferrer"&gt;streaming mode&lt;/a&gt;, unlike other libraries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;commands are run &lt;a href="https://github.com/almost/through2-concurrent" rel="noopener noreferrer"&gt;in parallel&lt;/a&gt;, not &lt;a href="https://github.com/rvagg/through2" rel="noopener noreferrer"&gt;serially&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;output can be saved &lt;a href="https://github.com/ehmicky/gulp-execa/blob/master/README.md#result" rel="noopener noreferrer"&gt;either in files or in variables&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example &lt;code&gt;gulpfile.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dest&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gulp&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;stream&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gulp-execa&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;audit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;npm audit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;outdated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;npm outdated&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sort&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="nf"&gt;src&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*.txt&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;`sort &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;dest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sorted&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The full documentation is available on &lt;a href="https://github.com/ehmicky/gulp-execa" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>shell</category>
    </item>
    <item>
      <title>Wrap a JavaScript function without changing its name/properties (by sindresorhus)</title>
      <dc:creator>ehmicky</dc:creator>
      <pubDate>Wed, 19 Jun 2019 14:32:53 +0000</pubDate>
      <link>https://forem.com/ehmicky/wrap-a-javascript-function-without-changing-its-name-properties-by-sindresorhus-528p</link>
      <guid>https://forem.com/ehmicky/wrap-a-javascript-function-without-changing-its-name-properties-by-sindresorhus-528p</guid>
      <description>&lt;p&gt;Wrapping a JavaScript function is not as simple as one might think. Some of the issues you might encounter include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;keeping the original function &lt;code&gt;name&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;keeping the original function static properties and inherited properties&lt;/li&gt;
&lt;li&gt;showing the original function's body when using &lt;code&gt;String(function)&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;mimic-fn&lt;/code&gt; is a small utility by sindresorhus tackling this issue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/sindresorhus/mimic-fn"&gt;https://github.com/sindresorhus/mimic-fn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>functional</category>
    </item>
    <item>
      <title>Tools for writing cross-platform Node.js</title>
      <dc:creator>ehmicky</dc:creator>
      <pubDate>Tue, 09 Apr 2019 14:25:37 +0000</pubDate>
      <link>https://forem.com/ehmicky/tools-for-writing-cross-platform-node-js-38f7</link>
      <guid>https://forem.com/ehmicky/tools-for-writing-cross-platform-node-js-38f7</guid>
      <description>&lt;p&gt;Cross-platform Node.js is important: according to the &lt;a href="https://nodejs.org/en/user-survey-report/#Primary-OS-Distro"&gt;2018 Node.js user survey&lt;/a&gt;, 24% of Node.js developers use Windows locally and 41% use Mac. In production 85% use Linux and 1% use BSD.&lt;/p&gt;

&lt;p&gt;If you'd like to make your code more cross-platform, check out the following list of resources!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/bcoe/awesome-cross-platform-nodejs"&gt;https://github.com/bcoe/awesome-cross-platform-nodejs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>windows</category>
      <category>macos</category>
    </item>
    <item>
      <title>Show some 🖤 to Node.js process errors</title>
      <dc:creator>ehmicky</dc:creator>
      <pubDate>Tue, 02 Apr 2019 14:04:11 +0000</pubDate>
      <link>https://forem.com/ehmicky/show-some-to-node-js-process-errors-5fdl</link>
      <guid>https://forem.com/ehmicky/show-some-to-node-js-process-errors-5fdl</guid>
      <description>&lt;p&gt;Node.js prints process errors (&lt;code&gt;uncaughtException&lt;/code&gt;, &lt;code&gt;warning&lt;/code&gt;, &lt;code&gt;unhandledRejection&lt;/code&gt;, &lt;code&gt;rejectionHandled&lt;/code&gt;) on the console which is very useful. Unfortunately those errors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;do not show stack traces for &lt;code&gt;warning&lt;/code&gt; and &lt;code&gt;rejectionHandled&lt;/code&gt; making them hard to debug.&lt;/li&gt;
&lt;li&gt;do not include &lt;code&gt;multipleResolves&lt;/code&gt; errors (when a promise is resolved/rejected twice).&lt;/li&gt;
&lt;li&gt;are inconvenient to log to an external service.&lt;/li&gt;
&lt;li&gt;are hard to test.&lt;/li&gt;
&lt;li&gt;cannot be conditionally skipped.&lt;/li&gt;
&lt;li&gt;are printed each time an error is repeated (except for &lt;code&gt;warning&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;are not human-friendly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I have created a library that fixes all those issues: &lt;a href="https://github.com/ehmicky/log-process-errors"&gt;&lt;code&gt;log-process-errors&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Feel free to check it out at &lt;a href="https://github.com/ehmicky/log-process-errors"&gt;https://github.com/ehmicky/log-process-errors&lt;/a&gt;. Any feedback is welcome!&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>debugging</category>
      <category>testing</category>
    </item>
    <item>
      <title>Swiss Army knife for Unix permissions</title>
      <dc:creator>ehmicky</dc:creator>
      <pubDate>Wed, 30 Jan 2019 18:10:06 +0000</pubDate>
      <link>https://forem.com/ehmicky/swiss-army-knife-for-unix-permissions-3fcj</link>
      <guid>https://forem.com/ehmicky/swiss-army-knife-for-unix-permissions-3fcj</guid>
      <description>&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/File_system_permissions"&gt;Unix file permissions&lt;/a&gt; can take many shapes: symbolic (&lt;code&gt;ug+rw&lt;/code&gt;), octal (&lt;code&gt;660&lt;/code&gt;) or a list of characters (&lt;code&gt;drw-rw----&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;unix-permissions&lt;/code&gt; (&lt;a href="https://github.com/ehmicky/unix-permissions"&gt;https://github.com/ehmicky/unix-permissions&lt;/a&gt;) enables using any of these (instead of being limited to a single one) with any Node.js or CLI command.&lt;/p&gt;

&lt;p&gt;This library can also perform operations on Unix permissions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;testing, setting and unsetting. Using bitwise operations (&lt;code&gt;|&lt;/code&gt;, &lt;code&gt;&amp;amp;&lt;/code&gt;, &lt;code&gt;^&lt;/code&gt;, &lt;code&gt;~&lt;/code&gt;) can be tedious and error-prone otherwise.&lt;/li&gt;
&lt;li&gt;validating syntax.&lt;/li&gt;
&lt;li&gt;normalizing. For example &lt;code&gt;u+r,u+w&lt;/code&gt; can be shortened to &lt;code&gt;u+rw&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;inverting. For example a &lt;a href="https://linux.die.net/man/2/umask"&gt;&lt;code&gt;umask&lt;/code&gt;&lt;/a&gt; of &lt;code&gt;117&lt;/code&gt; means new files will be created with &lt;code&gt;661&lt;/code&gt; permissions.&lt;/li&gt;
&lt;li&gt;checking the minimal or maximal permissions among a list of them. This can be useful to aggregate all the permissions of several files, e.g. during a directory recursion.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feel free to provide me with feedback on dev.to or on GitHub!&lt;/p&gt;

</description>
      <category>unix</category>
      <category>security</category>
      <category>node</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Cross-platform Node.js guide</title>
      <dc:creator>ehmicky</dc:creator>
      <pubDate>Mon, 21 Jan 2019 14:15:57 +0000</pubDate>
      <link>https://forem.com/ehmicky/portable-nodejs-guide-22oc</link>
      <guid>https://forem.com/ehmicky/portable-nodejs-guide-22oc</guid>
      <description>&lt;p&gt;Writing Node.js code that works on Windows, Mac and Linux can be tricky. There are only few guides that cover this topic thoroughly so I decided to share my own experience gathered over the years: &lt;a href="https://github.com/ehmicky/cross-platform-node-guide"&gt;https://github.com/ehmicky/cross-platform-node-guide&lt;/a&gt;&lt;/p&gt;

</description>
      <category>windows</category>
      <category>node</category>
      <category>linux</category>
      <category>mac</category>
    </item>
  </channel>
</rss>
