Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb007bb

Browse files
committed
file size improvements for browser distribution
1 parent 8dcc486 commit bb007bb

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

build.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"use strict"
2+
3+
var bake = require("cwise-bake")
4+
5+
console.log("module.exports=require('cwise-compiler')(" + JSON.stringify(
6+
bake({
7+
args: ["array", "scalar", "index"],
8+
body: function(o, a, x) {
9+
var v=a,i
10+
for(i=0;i<x.length-1;++i) {
11+
v=v[x[i]]
12+
}
13+
o=v[x[x.length-1]]
14+
},
15+
funcName: "convert"
16+
})) + ")")

convert.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
"use strict"
22

33
var ndarray = require("ndarray")
4-
var cwise = require("cwise")
5-
6-
var do_convert = cwise({
7-
args: ["array", "scalar", "index"],
8-
body: function(out, a, idx) {
9-
var v = a
10-
for(var i=0; i<idx.length-1; ++i) {
11-
v = v[idx[i]]
12-
}
13-
out = v[idx[idx.length-1]]
14-
}
15-
})
4+
var do_convert = require("./doConvert.js")
165

176
module.exports = function convert(arr, result) {
187
var shape = [], c = arr, sz = 1

doConvert.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
{
22
"name": "ndarray-pack",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Packs an array-of-arrays into a single ndarray",
55
"main": "convert.js",
66
"directories": {
77
"test": "test"
88
},
99
"dependencies": {
10-
"cwise": "^0.3.2",
11-
"ndarray": "^1.0.13"
10+
"ndarray": "^1.0.13",
11+
"cwise-compiler": "^0.1.0"
1212
},
1313
"devDependencies": {
14-
"tap": "~0.4.2"
14+
"tap": "~0.4.2",
15+
"cwise-bake": "0.0.0"
1516
},
1617
"scripts": {
17-
"test": "tap test/*.js"
18+
"test": "tap test/*.js",
19+
"build": "node build.js > doConvert.js"
1820
},
1921
"repository": {
2022
"type": "git",

0 commit comments

Comments
 (0)