db backup prior to drupal security update
[yaffs-website] / node_modules / individual / README.md
1 # individual
2
3 [![build status][build-png]][build] [![Coverage Status][cover-png]][cover] [![Davis Dependency status][dep-png]][dep]
4
5 [![NPM][npm-png]][npm]
6
7 [![browser support][test-png]][test]
8
9 Garantueed individual values
10
11 ## Example
12
13 ```js
14 var Individual = require("individual")
15
16 var moduleCache = Individual("__MY_MODULE_CACHE", {})
17
18 // moduleCache is a individual variable local to this file.
19 // It will always be the same value and defaults to {}.
20 ```
21
22 This gives you a singleton value by a unique name (it stores it
23 as a global variable).
24
25 ## Use cases
26
27 Your module has an internal cache. If your module is loaded
28     twice, (someone didn't npm dedup and has two copies of your
29     module) you would have two seperate caches that dont talk
30     to each other.
31
32 Best case your cache is less efficient. Worst case you have a
33     cache because the native C++ extension you talk to crashes
34     if you instantiate something twice.
35
36 You need a garantuee that this value is an individual, there is
37     only one of it.
38
39 I use it myself because opening a SockJS websocket to the same
40     URI twice causes an infinite loop. I need a garantuee that
41     I have an individual value for the SockJS connection so I
42     can see whether I already have an open connection.
43
44 ## WHY GLOBALS >:(
45
46 I can't imagine any other way to do it. I hate it too. Make a
47     pull request if you know the real solution
48
49 ## Installation
50
51 `npm install individual`
52
53 ## Contributors
54
55  - Raynos
56
57 ## MIT Licenced
58
59   [build-png]: https://secure.travis-ci.org/Raynos/individual.png
60   [build]: https://travis-ci.org/Raynos/individual
61   [cover-png]: https://coveralls.io/repos/Raynos/individual/badge.png
62   [cover]: https://coveralls.io/r/Raynos/individual
63   [dep-png]: https://david-dm.org/Raynos/individual.png
64   [dep]: https://david-dm.org/Raynos/individual
65   [test-png]: https://ci.testling.com/Raynos/individual.png
66   [test]: https://ci.testling.com/Raynos/individual
67   [npm-png]: https://nodei.co/npm/individual.png?stars&downloads
68   [npm]: https://nodei.co/npm/individual
69