• Stars
    star
    218
  • Rank 175,951 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

More Repositories

1

find-my-way

A crazy fast HTTP router
JavaScript
1,424
star
2

fastify-example

This project is a small but feature complete application build with Fastify and Svelte, and it aims to show all the core concepts of Fastify, best practices, and recommendations.
JavaScript
654
star
3

hpagent

A ready to use http and https agent for working with proxies that keeps connections alive!
JavaScript
178
star
4

router-benchmark

Benchmark of the most commonly used http routers
JavaScript
75
star
5

Tyval

Fast and extensible validator for JavaScript
JavaScript
61
star
6

fastify-architecture-workshop

JavaScript
58
star
7

workq

A super tiny work queue
JavaScript
38
star
8

fast-decode-uri-component

Fast and safe decodeURIComponent
JavaScript
28
star
9

easy-breaker

A simple and low overhead circuit breaker utility.
JavaScript
20
star
10

LightFirewall

Lightweight firewall built for NodeJs.
JavaScript
17
star
11

appversion

AppVersion is a CLI tool whose purpose is to provide a unique manager of the version of you application.
JavaScript
17
star
12

fastify-101

Learn Fastify talk!
14
star
13

rinvoke

RPC library based on net sockets, can work both with tcp sockets and ipc.
JavaScript
12
star
14

monoliths-always-pay-their-debts

JavaScript
11
star
15

What-if-I-told-you-that-HTTP-can-be-fast

Fastify and node performances talk.
JavaScript
8
star
16

fast-json-body

Parse your json body at max speed and safely.
JavaScript
7
star
17

yaml-template

Declare js objects with style using yaml syntax.
JavaScript
7
star
18

semver-store

An extremely fast semver based store.
JavaScript
7
star
19

pino-to-ecs

Converts Pino logs to Elastic Common Schema.
JavaScript
6
star
20

electron-screen

Small Module that returns an array with all the monitors connected to the pc with their resolution and position.
C++
5
star
21

diapo

Easy to use, markdown based presentation framework with sane defaults.
JavaScript
4
star
22

demodb

An HTTP based database for demo purposes, workshop and so on.
JavaScript
3
star
23

Microservices

Microservices architectural studies
JavaScript
3
star
24

YourMomBot

A simple "How is your mom" telegram bot.
JavaScript
2
star
25

is-elasticsearch-running

A small utility to verify if an Elasticsearch cluster is up and running.
JavaScript
2
star
26

dotfiles

My dotfiles.
Vim Script
2
star
27

undici-proxy-example

JavaScript
2
star
28

FileFactory

FileFactory is a easy to use utility for managing files built for Cordova, compatible with Angular and Ionic.
JavaScript
2
star
29

YahooWeatherProcessing

Yahoo Weather library for Processing
Java
2
star
30

maptd-workshop

Monolith always pay their debts - workshop code
JavaScript
2
star
31

old-FilmHunter

Movie Search WebApp
JavaScript
1
star
32

shape-of-q

A simple and fast redis based queue, supports both fifo and lifo.
JavaScript
1
star
33

fast-iterator

Fast execution of an array of functions with the same value as input that can be altered.
JavaScript
1
star
34

dom.js

Dom manipulation library, super early alpha.
JavaScript
1
star
35

omxloop

Script for looping Omxplayer.
Shell
1
star
36

why-we-built-another-framework

JavaScript
1
star
37

self-stream

A small node module that streams your transformations to the same file
JavaScript
1
star
38

SCaaS

SuperCazzola as a Service
JavaScript
1
star
39

whatwg-headers

JavaScript
1
star
40

Language-Based-Security

Repository of the exercises and the project of the Chalmers Language-Based Security Course.
JavaScript
1
star