@@ -10,10 +10,11 @@ sequential and human-readable ids.
1010
1111| aspect| detail|
1212| -------| -----:|
13- | version| 0.0.0-alpha.4.2 |
13+ | version| 0.0.0-alpha.5.0 |
1414| dependencies| none|
1515| node| 0.11, 0.10|
16- | last updated| 6th Oct, 2014|
16+ | last updated| 24th Oct, 2014|
17+
1718
1819## installation
1920
@@ -23,6 +24,7 @@ From [Npm][npmjs]:
2324$ npm install sequential-ids --save
2425```
2526
27+
2628## usage
2729
2830``` js
@@ -67,6 +69,7 @@ accessor.next('otherKey',function(err, id) {
6769});
6870```
6971
72+
7073## notes
7174
72751 . ** new Generator([ options] )**
@@ -81,7 +84,9 @@ accessor.next('otherKey',function(err, id) {
8184 * and, additionally, the same attributes as the Generator#add
8285 ** options** object
8386
84- * in a case where you may require more than one generator, you would allocate them to different ports. See ahead on how to target each of the different generators.
87+ * in a case where you may require more than one generator, you
88+ would allocate them to different ports. See ahead on how to target
89+ each of the different generators.
8590
8691 ``` js
8792 var sequential = require (" sequential-ids" );
@@ -92,10 +97,12 @@ accessor.next('otherKey',function(err, id) {
9297 * A generator has the following methods:
9398
9499 * ` Generator#start() `
95- * starts the generator. If no Error is thrown, the generator will be ready for Accessors.
100+ * starts the generator. If no Error is thrown, the generator will be
101+ ready for Accessors.
96102
97103 * ` Generator#add(key, [options]) `
98- * adds a new key to the generator. If no Error is thrown, the generator will be ready for Accessors.
104+ * adds a new key to the generator. If no Error is thrown, the
105+ generator will be ready for Accessors.
99106 * returns ` false ` if ` key ` had already been added to the
100107 generator; otherwise, returns ` true `
101108
@@ -111,22 +118,35 @@ accessor.next('otherKey',function(err, id) {
111118 * assigning ` 0 ` (zero) lets you ignore the letters part
112119 * Defaults to ` 3 ` .
113120 * ` store ` :
114- * a function that will be called to store the IDs on disk for persistence.
115- * the function is passed an array of IDs that have been generated.
116- * repeatedly storing the last ID is useful to know where to start from in the next session.
121+ * a function that will be called to store the IDs on disk for
122+ persistence.
123+ * the function is passed an array of IDs that have been
124+ generated.
125+ * repeatedly storing the last ID is useful to know where to
126+ start from in the next session.
117127 * Defaults to ` null ` .
118- * ` store\_freq ` :
128+ * ` store_freq ` :
119129 * frequency at which the store function should be called.
120130 * Defaults to ` 1 ` (called every 1 ID is generated)
121131 * ` restore ` :
122132 * last ID that was generated.
123133 * IDs will be generated from here on.
124- * ` digits ` and ` letters ` will be ignored so as to follow the restore ID style.
125- * it ** must** be in the same style as IDs generated by the Generator
134+ * ` digits ` and ` letters ` will be ignored so as to follow the
135+ restore ID style.
136+ * it ** must** be in the same style as IDs generated by the
137+ Generator
126138 * If not specified, generates from start.
127139 * ** MUST** be a string.
128140 * Overides the ` .digits ` and ` .letters ` options.
129141 * Defaults to ` null ` .
142+ * ` autoAddKeys ` :
143+ * whether to automatically add keys when IDs are requested
144+ with a non-existent key.
145+ * If ` true ` , such a key is added and an ID returned as though
146+ the key was already added using the Generator's options.
147+ * If ` false ` , an Error is passed to callback, if any, or ` null ` is
148+ returned.
149+ * Defaults to ` false ` .
130150
131151 * ` Generator#generate(key) `
132152 * generates a new ID for ** key** . If no ** key** is given, uses
@@ -140,12 +160,14 @@ accessor.next('otherKey',function(err, id) {
140160 * ` Generator#stop() `
141161 * stops the generator. No more IDs will be given to Accessors.
142162
143-
1441632 . ** new Accessor([ port] )**
145164
146165 * used to access IDs.
147- * ** port** is the port number of your generator. In case where, you did not specify a port when creating a Generator instance, you may leave this out. Defaults to ` 9876 ` .
148- * an accessor may be initialized in a separate file. Ensure you got the port numbers correct.
166+ * ** port** is the port number of your generator. In case where, you
167+ did not specify a port when creating a Generator instance, you may
168+ leave this out. Defaults to ` 9876 ` .
169+ * an accessor may be initialized in a separate file. Ensure you got the
170+ port numbers correct.
149171 * an accessor has the following methods:
150172
151173 * ` Accessor#next(key,callback) ` :
@@ -167,9 +189,12 @@ accessor.next('otherKey',function(err, id) {
167189
168190* Robust Error handling
169191* Implement these features:
170- * ` session(callback) ` - passes the number of IDs generated in the session.
192+ * ` session(callback) ` - passes the number of IDs generated in the
193+ session.
171194 * ` .used(callback) ` - passes the total number of IDs generated.
172- * ` .semantics(callback) ` - passes the remaining no. of IDs to be generated before breaking our semantics specified while creating the generator.
195+ * ` .semantics(callback) ` - passes the remaining no. of IDs to be
196+ generated before breaking our semantics specified while creating
197+ the generator.
173198
174199
175200## contribution
@@ -178,11 +203,18 @@ accessor.next('otherKey',function(err, id) {
178203* Pull requests be accompanied with tests as in the ` /tests ` directory
179204* Issues may be filed [ here] [ issues ]
180205
206+ A list of contributors:
207+
208+ 1 . [ GochoMugo] ( https://github.com/GochoMugo )
209+ * [ André Santos] ( https://github.com/andrefs )
210+
211+
181212## license
182213
183214Copyright (c) 2014 Forfuture LLC
184215
185- Sequential Ids and its source code are licensed under the [ MIT] [ mit ] license. See [ LICENSE] ( LICENSE ) file accompanying this text.
216+ Sequential Ids and its source code are licensed under the [ MIT] [ mit ]
217+ license. See [ LICENSE] ( LICENSE ) file accompanying this text.
186218
187219
188220[ issues ] :https://github.com/forfuture-dev/node-sequential-ids/issues
0 commit comments