global-agent icon indicating copy to clipboard operation
global-agent copied to clipboard

Suggestion : remove "boolean" package dependency

Open guiled opened this issue 1 year ago • 4 comments
trafficstars

The "boolean" dependency is quite light, but is also absolutely overkill. It is only used in one line, just to check that a env config matches some string values. I think it took more time to search for and include this package than code the desire behaviour.

guiled avatar Oct 15 '24 11:10 guiled

The boolean package has been deprecated:

https://www.npmjs.com/package/boolean

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

silverwind avatar Oct 22 '24 10:10 silverwind

boolean is not only now unsupported, also the repository link in the npm registry no longer works.

$ npm view boolean

[email protected] | MIT | deps: none | versions: 22
boolean converts lots of things to boolean.
https://github.com/thenativeweb/boolean#readme

DEPRECATED ⚠️  - Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

keywords: boolean, parser

dist
.tarball: https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz
.shasum: 9e5294af4e98314494cbb17979fa54ca159f116b
.integrity: sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==
.unpackedSize: 12.5 kB

maintainers:
- thenativeweb-admin <[email protected]>

dist-tags:
latest: 3.2.0

published over a year ago by thenativeweb-admin <[email protected]>

https://github.com/thenativeweb exists, but https://github.com/thenativeweb/boolean does not (HTTP 404 error).

MikeMcC399 avatar Nov 10 '24 12:11 MikeMcC399

Should be easy enough to replace, this is the whole module:

const boolean = function (value: any): boolean {
  switch (Object.prototype.toString.call(value)) {
    case '[object String]':
      return [ 'true', 't', 'yes', 'y', 'on', '1' ].includes(value.trim().toLowerCase());
    case '[object Number]':
      return value.valueOf() === 1;
    case '[object Boolean]':
      return value.valueOf();
    default:
      return false;
  }
};

silverwind avatar Nov 11 '24 18:11 silverwind

use npm install electron@latest

MagicalEarner avatar Nov 20 '24 17:11 MagicalEarner