npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

electron-is

v3.0.0

Published

An 'is' utility for Electron which provides a set of handy functions, with a self-descriptive name.

Downloads

8,450

Readme

electron-is

js-standard-style Build Status

An 'is' utility for Electron.
electron-is provides a set of isomorphic 'is' APIs, that you can use it both in main and renderer process.
See usage for more information.

Install

$ npm install electron-is --save

API

  • is.renderer()
    Returns true if you are calling the function from the renderer process.

  • is.main()
    Returns true if you are calling the function from the main process.

  • is.macOS() aliases is.osx()
    Returns true if your app is running under Mac OS.

  • is.windows()
    Returns true if your app is running under Windows OS.

  • is.linux()
    Returns true if your app is running under Linux OS.

  • is.x86()
    Returns true if you the architecture of the processor is ia32.

  • is.x64()
    Returns true if you the architecture of the processor is x64.

  • is.production()
    Returns true if you are running the app in a production environment.

  • is.dev()
    Returns true if you are running the app in a dev environment.

  • is.sandbox() only macOS
    Returns true if you are running the app in a sandbox environment under macOS.

  • is.mas()
    Returns true if the app is running as a Mac App Store build.

  • is.windowsStore()
    Returns true if the app is running as a Windows Store (appx) build.

  • is.all(args)
    Returns true if all the 'is functions' passed as argument are true.
    example: is.all(is.osx, is.x64)

  • is.none(args)
    Returns true if all the 'is functions' passed as argument are false.
    example: is.none(is.windows, is.x86, is.main)

  • is.one(args)
    Returns true if one of the 'is functions' passed as argument is true.
    example: is.one(is.osx, is.linux)

  • is.release(args)
    Checks the if the given release is the same of the OS (*)
    example: is.release('10.0.10586')

  • is.gtRelease(args)
    Checks if the given release is greater than the current OS release (*)
    example: is.gtRelease('10.9.5')

  • is.ltRelease(args)
    Checks if the given release is less than the current OS release (*)
    example: is.ltRelease('6.3')

The Mac versions are mapped as osx: darwin, you must pass the 9.x.y or 10.x.y OSX version as argument and not the darwin version.
If you are testing a Windows release you must pass the NT release, it can be x.y or x.y.build .

* Not implemented for Linux yet

Usage

  • In Main process:
// es6
import is from 'electron-is'
// es5
const is = require('electron-is')
console.log(is.main())
  • In Renderer process:
<script>
    const is = require('electron-is')
    console.log(is.renderer())
</script>

Acknowledgements

electron-is makes use of electron-is-dev package from @sindresorhus.

Contributing

If you feel you can help in any way, be it with examples, extra testing, or new features please open a pull request or open an issue.

The code follows the Standard code style.
js-standard-style


License

MIT

The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

Copyright © 2016 Tomas Della Vedova