1.1.0 • Published 9 years ago
platform-specific v1.1.0
platform-specific
React and React-Native platform detection without having to depend on React Native or React directly. This module uses (or abuses) the platform specific extensions and package.json properties to serve up the correct platform specification.
- For browsers it assumes that bundlers use the
browserfield in thepackage.json. - For React-Native on Android it assumes that
index.android.jsis loaded. - For React-Native on iOS it assumes that
index.ios.jsis loaded. - For React-Native on Windows it assumes that
index.win.jsis loaded. - For everything else it assumes
index.jsis selected by default (such as node.js)
Installation
The module is released in the public npm registry and can be installed by running:
npm isntall --save platform-specificUsage
Simply require the module in your application/code/component:
import platform from 'platform-specific';The returned platform variable now contains an object the following keys:
typesetjsunless it's used on react-native then it's set toreact-nativeplatformwhich can beandroid,ios,browserornode
License
MIT