10 examples of 'map in node js' in JavaScript

Every line of 'map in node js' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
5export default function map(ast) {
6 const results = [];
7 traverse(ast, {
8 enter(path) {
9 const node = path.node;
10 results.push(nodeName(node));
11 }
12 });
13 return results;
14}
58function cjsMapFile(mapFilePath) { return mapFilePath; }
7function MapNode(key, val) {
8 this.key = key;
9 this.value = val;
10 this.prev = this;
11 this.next = this;
12}
92function map(nodes, cb) {
93 for (var i=0, l=nodes.length; i
56function map(v,k,n){
57 var at = this, env = at.env, is, tmp;
58 if(Node._ === k && obj_has(v,Val.link._)){
59 return n._; // TODO: Bug?
60 }
61 if(!(is = valid(v,k,n, at,env))){ return }
62 if(!k){
63 at.node = at.node || n || {};
64 if(obj_has(v, Node._) && Node.soul(v)){ // ? for safety ?
65 at.node._ = obj_copy(v._);
66 }
67 at.node = Node.soul.ify(at.node, Val.link.is(at.link));
68 at.link = at.link || Val.link.ify(Node.soul(at.node));
69 }
70 if(tmp = env.map){
71 tmp.call(env.as || {}, v,k,n, at);
72 if(obj_has(n,k)){
73 v = n[k];
74 if(u === v){
75 obj_del(n, k);
76 return;
77 }
78 if(!(is = valid(v,k,n, at,env))){ return }
79 }
80 }
81 if(!k){ return at.node }
82 if(true === is){
83 return v;
84 }
85 tmp = node(env, {obj: v, path: at.path.concat(k)});
86 if(!tmp.node){ return }
87 return tmp.link; //{'#': Node.soul(tmp.node)};
88}
52return function _map(node, func) {
53 var steps = walker(node);
54 var notKeys = [];
55 for(var i = 0; i < steps.length; i++) {
56 notKeys.push(steps[i][0]);
57 }
58 var ret = func(deepCopy(node, notKeys));
59 for(var i = 0; i < steps.length; i++) {
60 var kid;
61 var prop = steps[i][0];
62 var child = steps[i][1];
63 if(Array.isArray(child)) {
64 kid = [];
65 for(var j = 0; j < child.length; j++) {
66 kid.push(this.map(child[j], func));
67 }
68 } else {
69 kid = this.map(child, func);
70 }
71 deepSet(ret, prop, kid);
72 }
73 return ret;
74}
48function mapNode(node) {
49 let resultNode = node.value;
50 let r = /.*\/(.*)$/g;
51 resultNode.InstanceId = r.exec(node.key)[1];
52 return resultNode;
53}
190function genMap(map) {
191 console.log("map", map);
192 var src=map.attr("src");
193 var mapF=convFiles[dstDir.rel(src)];
194 var ary=mapF.asUint8Array();
195 var pwidth=map.attr("inst_pwidth");
196 var pheight=map.attr("inst_pheight");
197 var width=map.attr("inst_width");
198 var height=map.attr("inst_height");
199 console.log(pwidth, pheight, width, height,ary);
200 var buf="";
201 var mapFile=dstDir.rel("maps/").rel(dstDir.rel(src).name());
202 buf+=T1Map(pwidth, pheight, width, height,ary,mapFile, mem);
203 return buf;
204}
10function map() {
11 // notice: MongoDB will not call the reduce function for a key that has only a single value
12 // => emit same kind of output as reduce()'s
13 if (!this.err) return;
14 var val = { total: 1 };
15 // consider URLs (starting with http or //) as `fi` (source: file)
16 var playerId =
17 this.eId[0] === '/' && this.eId[1] !== '/' ? this.eId.substr(1, 2) : 'fi';
18 val[playerId] = 1;
19 delete this.err.track; // in order to prevent `key too large to index`
20 delete this.err.pId;
21 delete this.err.trackUrl;
22 return emit(JSON.stringify(this.err), val); // group by error object (contains source, code and message)
23}
694function mapVisit(node, fn) {
695 node.nodes.forEach(n => visit(n, fn));
696 return node;
697}

Related snippets