1.0.1 • Published 5 years ago

window-get v1.0.1

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

window-get

A utility for getting properties from the window object in projects that render on both the server and the client.

Installation

npm install window-get

Usage

import windowGet from 'window-get';

window.foo = {bar: 'baz'}
windowGet('foo.bar')
=> 'baz'
Works with arrays
window.foo = [{bar: 'baz'}]
windowGet('foo.0.bar')
=> 'baz'
Window doesn't exist (server side)
windowGet('foo.bar')
=> null

// With default
windowGet('foo.bar', 'qux')
=> 'qux'
1.0.1

5 years ago

1.0.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago