express-state
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -59,3 +59,5 @@ 'use strict'; | ||
this.__namespaces__.forEach(function (namespace) { | ||
var parts = []; | ||
var parts = namespace.split('.'), | ||
leafPart = parts.pop(), | ||
nsPart = 'g'; | ||
@@ -65,16 +67,9 @@ // Renders the JavaScript to instantiate each namespace as needed, and | ||
// namespace once. | ||
if (!rendered[namespace]) { | ||
namespace.split('.').forEach(function (part, i) { | ||
var ns; | ||
while (parts.length) { | ||
nsPart += '.' + parts.shift(); | ||
parts.push(part); | ||
ns = parts.join('.'); | ||
if (!rendered[ns]) { | ||
rendered[ns] = true; | ||
ns = 'g.' + ns; | ||
namespaces.push(ns + ' || (' + ns + ' = {});'); | ||
} | ||
}); | ||
if (!rendered[nsPart]) { | ||
rendered[nsPart] = true; | ||
namespaces.push(nsPart + ' || (' + nsPart + ' = {});'); | ||
} | ||
} | ||
@@ -85,3 +80,4 @@ | ||
// exposed via the `add()` method. | ||
exposed.push('g.' + namespace + ' = ' + serialize(this[namespace]) + ';'); | ||
nsPart += '.' + leafPart; | ||
exposed.push(nsPart + ' = ' + serialize(this[namespace]) + ';'); | ||
}, this); | ||
@@ -88,0 +84,0 @@ |
@@ -37,7 +37,6 @@ 'use strict'; | ||
return str.replace(PLACE_HOLDER_REGEX, function (match, type, index) { | ||
if (type === 'FUNCTION') { | ||
switch (type) { | ||
case 'FUNCTION': | ||
return functions[index].toString(); | ||
} | ||
if (type === 'REGEXP') { | ||
case 'REGEXP': | ||
return regexps[index].toString(); | ||
@@ -44,0 +43,0 @@ } |
{ | ||
"name" : "express-state", | ||
"description": "Expose an Express app's state via client-side JavaScript.", | ||
"version" : "0.0.1", | ||
"description": "Share server-side state with the client-side of an Express app via JavaScript.", | ||
"version" : "0.0.2", | ||
"homepage" : "https://github.com/yahoo/express-state", | ||
"keywords": [ | ||
"express", "state", "client", "expose", "data", "config", "javascript" | ||
"express", "state", "client", "expose", "data", "config", "javascript", "model", "json" | ||
], | ||
@@ -10,0 +10,0 @@ |
@@ -7,4 +7,7 @@ Express State | ||
[![Build Status](https://travis-ci.org/yahoo/express-state.png?branch=master)][Build Status] | ||
[Express]: https://github.com/visionmedia/express | ||
[Build Status]: https://travis-ci.org/yahoo/express-state | ||
@@ -19,3 +22,9 @@ | ||
Install using npm: | ||
```shell | ||
$ npm install express-state | ||
``` | ||
Usage | ||
@@ -22,0 +31,0 @@ ----- |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32115
15
43
680