Babelify within noms js module

This commit is contained in:
Rafael Weinstein
2015-07-20 17:59:42 -07:00
parent 0087a45df9
commit e20ed5c289
7 changed files with 18 additions and 8 deletions
+1
View File
@@ -1,4 +1,5 @@
pushd ../../js
npm run build
./link.sh
popd
npm link noms
+1
View File
@@ -1,4 +1,5 @@
pushd ../../../js
npm run build
./link.sh
popd
npm link noms
+1
View File
@@ -1 +1,2 @@
node_modules
dist
+8 -1
View File
@@ -1,7 +1,14 @@
{
"name": "noms",
"main": "noms.js",
"main": "dist/noms.js",
"dependencies": {
"immutable": "^3.7.4"
},
"devDependencies": {
"babel": "^5.6.23"
},
"scripts": {
"start": "babel -w src/ -d dist/",
"build": "babel src/ -d dist/"
}
}
+7 -7
View File
@@ -5,9 +5,9 @@ var Immutable = require('immutable');
var refMapping = new WeakMap();
function decodeMap(input, ref, getChunk) {
return Promise.all(input.map(function(value) {
return Promise.all(input.map((value) => {
return decodeValue(value, ref, getChunk);
})).then(function(values) {
})).then((values) => {
var pairs = [];
for (var i = 0; i < input.length; i += 2) {
pairs.push([values[i], values[i+1]]);
@@ -19,9 +19,9 @@ function decodeMap(input, ref, getChunk) {
}
function decodeList(input, ref, getChunk) {
return Promise.all(input.map(function(value) {
return Promise.all(input.map((value) => {
return decodeValue(value, ref, getChunk);
})).then(function(values) {
})).then((values) => {
var value = Immutable.List(values);
refMapping.set(value, ref);
return value;
@@ -29,9 +29,9 @@ function decodeList(input, ref, getChunk) {
}
function decodeSet(input, ref, getChunk) {
return Promise.all(input.map(function(value) {
return Promise.all(input.map((value) => {
return decodeValue(value, ref, getChunk);
})).then(function(values) {
})).then((values) => {
var value = Immutable.Set(values);
refMapping.set(value, ref);
return value;
@@ -93,7 +93,7 @@ function decodeValue(value, ref, getChunk) {
}
function readValue(ref, getChunk) {
return getChunk(ref).then(function(data) {
return getChunk(ref).then((data) => {
switch(data[0]) {
case 'j':
var json = JSON.parse(data.substring(2))
View File