GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — angular/node_modules/astw/index.js at master · rkshgupta/angular Expand file tree/ Copy pathindex.jsMore file actions 52 lines (47 loc) · 1.34 KB / Copy pathindex.jsFile metadata and controls52 lines (47 loc) · 1.34 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 var parse = require('acorn').parse; module.exports = function (src, opts) { if (!opts) opts = {} var ast = src; if (typeof src === 'string') { try { ast = parse(src, { ecmaVersion: opts.ecmaVersion || 8, allowReturnOutsideFunction: true }) } catch (err) { ast = parse('(' + src + ')') } } return function (cb) { walk(ast, undefined, cb); }; }; function walk (node, parent, cb) { var keys = objectKeys(node); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (key === 'parent') continue; var child = node[key]; if (isArray(child)) { for (var j = 0; j < child.length; j++) { var c = child[j]; if (c && typeof c.type === 'string') { c.parent = node; walk(c, node, cb); } } } else if (child && typeof child.type === 'string') { child.parent = node; walk(child, node, cb); } } cb(node); } var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; var objectKeys = Object.keys || function (obj) { var keys = []; for (var key in obj) keys.push(key); return keys; }; |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |