🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

systemjs-plugin-json

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

systemjs-plugin-json - npm Package Compare versions

Comparing version

to
0.3.0

@@ -5,3 +5,10 @@ /*

define({
// this code allows named exports of valid identifiers in json to work with rollup
// so you can effectively "pick" a json value and have the other base-level json values excluded
// not comprehensive of course
function isValidIdentifier(exportName) {
return exportName.match(/^[a-zA-Z_$][0-9a-zA-Z_$]*$/);
}
module.exports = {
translate: function(load) {

@@ -13,9 +20,2 @@ var json = JSON.parse(load.source);

var namedExports = Object.keys(json);
// this code allows named exports of valid identifiers in json to work with rollup
// so you can effectively "pick" a json value and have the other base-level json values excluded
// not comprehensive of course
function isValidIdentifier (exportName) {
return exportName.match(/^[a-zA-Z_$][0-9a-zA-Z_$]*$/);
}
var validIdentifiers = namedExports.filter(isValidIdentifier);

@@ -31,6 +31,8 @@

namedExports.forEach(function (exportName) {
if (validIdentifiers.indexOf(exportName) !== -1)
if (validIdentifiers.indexOf(exportName) !== -1) {
output.push(exportName + ': ' + exportName + ',\n');
else
}
else {
output.push(JSON.stringify(exportName) + ': ' + JSON.stringify(json[exportName]) + ',\n');
}
});

@@ -48,5 +50,6 @@

instantiate: function(load) {
if (!this.builder)
if (!this.builder) {
return JSON.parse(load.source);
}
}
});
}
{
"name": "systemjs-plugin-json",
"version": "0.2.3",
"version": "0.3.0",
"main": "json",
"scripts": {
"test": "serve ."
},
"repository": {

@@ -13,3 +16,7 @@ "type": "git",

},
"homepage": "https://github.com/systemjs/plugin-json"
"homepage": "https://github.com/systemjs/plugin-json",
"devDependencies": {
"serve": "^3.2.7",
"systemjs": "^0.20.5"
}
}
plugin-json
===========
[![CDNJS](https://img.shields.io/cdnjs/v/systemjs-plugin-json.svg)](https://cdnjs.com/libraries/systemjs-plugin-json)

@@ -7,1 +8,10 @@

Testing this project
--------------------
```sh
npm test
```
browse to <http://localhost:3000/test.html> and open the browser's development console.
You should see the json object logged.