lint
This commit is contained in:
parent
fd4284f5a2
commit
8c5fd9ec25
10 changed files with 248 additions and 286 deletions
108
.eslintrc.js
108
.eslintrc.js
|
|
@ -2,11 +2,9 @@ module.exports = {
|
|||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"globals": {
|
||||
"Promise": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"accessor-pairs": "error",
|
||||
|
|
@ -19,21 +17,20 @@ module.exports = {
|
|||
"arrow-parens": "error",
|
||||
"arrow-spacing": "error",
|
||||
"block-scoped-var": "off",
|
||||
"block-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"block-spacing": "off",
|
||||
"brace-style": "off",
|
||||
"callback-return": "off",
|
||||
"camelcase": "error",
|
||||
"comma-dangle": "off",
|
||||
"comma-spacing": [
|
||||
"camelcase": [
|
||||
"error",
|
||||
{
|
||||
"after": true,
|
||||
"before": false
|
||||
"properties": "never"
|
||||
}
|
||||
],
|
||||
"comma-dangle": [
|
||||
"error",
|
||||
"only-multiline"
|
||||
],
|
||||
"comma-spacing": "off",
|
||||
"comma-style": [
|
||||
"error",
|
||||
"last"
|
||||
|
|
@ -66,15 +63,10 @@ module.exports = {
|
|||
"indent": "off",
|
||||
"init-declarations": "off",
|
||||
"jsx-quotes": "error",
|
||||
"key-spacing": "error",
|
||||
"keyword-spacing": [
|
||||
"error",
|
||||
{
|
||||
"before": true,
|
||||
"after": true
|
||||
}
|
||||
],
|
||||
"lines-around-comment": "error",
|
||||
"key-spacing": "off",
|
||||
"keyword-spacing": "off",
|
||||
"linebreak-style": "off",
|
||||
"lines-around-comment": "off",
|
||||
"max-depth": "off",
|
||||
"max-len": "off",
|
||||
"max-nested-callbacks": "error",
|
||||
|
|
@ -87,19 +79,20 @@ module.exports = {
|
|||
"newline-per-chained-call": "off",
|
||||
"no-alert": "error",
|
||||
"no-array-constructor": "error",
|
||||
"no-bitwise": "off",
|
||||
"no-bitwise": "error",
|
||||
"no-caller": "error",
|
||||
"no-catch-shadow": "error",
|
||||
"no-catch-shadow": "off",
|
||||
"no-cond-assign": "off",
|
||||
"no-confusing-arrow": "error",
|
||||
"no-continue": "error",
|
||||
"no-console": "off",
|
||||
"no-continue": "off",
|
||||
"no-div-regex": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-else-return": "off",
|
||||
"no-empty-function": "off",
|
||||
"no-eq-null": "off",
|
||||
"no-eval": "error",
|
||||
"no-extend-native": "error",
|
||||
"no-extend-native": "off",
|
||||
"no-extra-bind": "error",
|
||||
"no-extra-label": "error",
|
||||
"no-extra-parens": "off",
|
||||
|
|
@ -108,14 +101,10 @@ module.exports = {
|
|||
"no-implicit-globals": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-inline-comments": "off",
|
||||
"no-inner-declarations": [
|
||||
"error",
|
||||
"functions"
|
||||
],
|
||||
"no-invalid-this": "off",
|
||||
"no-iterator": "error",
|
||||
"no-label-var": "error",
|
||||
"no-labels": "error",
|
||||
"no-label-var": "off",
|
||||
"no-labels": "off",
|
||||
"no-lone-blocks": "error",
|
||||
"no-lonely-if": "off",
|
||||
"no-loop-func": "off",
|
||||
|
|
@ -134,7 +123,7 @@ module.exports = {
|
|||
"no-new-wrappers": "error",
|
||||
"no-octal-escape": "error",
|
||||
"no-param-reassign": "off",
|
||||
"no-path-concat": "error",
|
||||
"no-path-concat": "off",
|
||||
"no-plusplus": "off",
|
||||
"no-process-env": "error",
|
||||
"no-process-exit": "error",
|
||||
|
|
@ -153,7 +142,7 @@ module.exports = {
|
|||
"no-spaced-func": "error",
|
||||
"no-sync": "off",
|
||||
"no-ternary": "off",
|
||||
"no-throw-literal": "error",
|
||||
"no-throw-literal": "off",
|
||||
"no-trailing-spaces": [
|
||||
"error",
|
||||
{
|
||||
|
|
@ -162,25 +151,17 @@ module.exports = {
|
|||
],
|
||||
"no-undef-init": "error",
|
||||
"no-undefined": "off",
|
||||
"no-underscore-dangle": "error",
|
||||
"no-underscore-dangle": "off",
|
||||
"no-unmodified-loop-condition": "error",
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-unsafe-finally": "error",
|
||||
"no-unused-expressions": "off",
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"varsIgnorePattern": "module"
|
||||
}
|
||||
],
|
||||
"no-use-before-define": "off",
|
||||
"no-useless-call": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-concat": "error",
|
||||
"no-useless-constructor": "error",
|
||||
"no-useless-escape": "off",
|
||||
"no-var": "off",
|
||||
"no-void": "error",
|
||||
"no-void": "off",
|
||||
"no-warning-comments": "off",
|
||||
"no-whitespace-before-property": "error",
|
||||
"no-with": "error",
|
||||
|
|
@ -188,12 +169,6 @@ module.exports = {
|
|||
"error",
|
||||
"never"
|
||||
],
|
||||
"object-property-newline": [
|
||||
"error",
|
||||
{
|
||||
"allowMultiplePropertiesPerLine": true
|
||||
}
|
||||
],
|
||||
"object-shorthand": "off",
|
||||
"one-var": "off",
|
||||
"one-var-declaration-per-line": "off",
|
||||
|
|
@ -201,57 +176,46 @@ module.exports = {
|
|||
"error",
|
||||
"always"
|
||||
],
|
||||
"operator-linebreak": [
|
||||
"error",
|
||||
"after"
|
||||
],
|
||||
"operator-linebreak": "off",
|
||||
"padded-blocks": "off",
|
||||
"prefer-arrow-callback": "off",
|
||||
"prefer-const": "error",
|
||||
"prefer-reflect": "off",
|
||||
"prefer-rest-params": "off",
|
||||
"prefer-spread": "off",
|
||||
"prefer-spread": "error",
|
||||
"prefer-template": "off",
|
||||
"quote-props": "off",
|
||||
"quotes": [
|
||||
"error",
|
||||
"double"
|
||||
"double",
|
||||
"avoid-escape"
|
||||
],
|
||||
"radix": [
|
||||
"error",
|
||||
"as-needed"
|
||||
"always"
|
||||
],
|
||||
"require-jsdoc": "off",
|
||||
"require-yield": "error",
|
||||
"semi": "off",
|
||||
"semi-spacing": [
|
||||
"error",
|
||||
{
|
||||
"after": true,
|
||||
"before": false
|
||||
}
|
||||
],
|
||||
"semi-spacing": "off",
|
||||
"sort-imports": "error",
|
||||
"sort-vars": "off",
|
||||
"space-before-blocks": "error",
|
||||
"space-before-blocks": "off",
|
||||
"space-before-function-paren": "off",
|
||||
"space-in-parens": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"space-infix-ops": "error",
|
||||
"space-unary-ops": "off",
|
||||
"space-infix-ops": "off",
|
||||
"space-unary-ops": "error",
|
||||
"spaced-comment": "off",
|
||||
"strict": "off",
|
||||
"template-curly-spacing": "error",
|
||||
"valid-jsdoc": "error",
|
||||
"valid-jsdoc": "off",
|
||||
"vars-on-top": "off",
|
||||
"wrap-iife": "error",
|
||||
"wrap-iife": "off",
|
||||
"wrap-regex": "error",
|
||||
"yield-star-spacing": "error",
|
||||
"yoda": [
|
||||
"error",
|
||||
"never"
|
||||
]
|
||||
"yoda": "off"
|
||||
}
|
||||
};
|
||||
|
|
@ -22,7 +22,7 @@ function run(input, output) {
|
|||
var declaration = /^\s*(?:var|let|const|function)[\t ]+([\w_$]+)/gm
|
||||
var include = /(?:((?:var|let|const|,|)[\t ]*)([\w_$\.]+)(\s*=\s*))?require\(([^\)]+)\)(\s*[`\.\(\[])?/gm
|
||||
var uuid = 0
|
||||
function process(filepath, data) {
|
||||
var process = function(filepath, data) {
|
||||
data.replace(declaration, function(match, binding) {bindings[binding] = 0})
|
||||
|
||||
return data.replace(include, function(match, def, variable, eq, dep, rest) {
|
||||
|
|
@ -38,7 +38,7 @@ function run(input, output) {
|
|||
})
|
||||
}
|
||||
|
||||
function resolve(filepath, filename) {
|
||||
var resolve = function(filepath, filename) {
|
||||
if (filename[0] !== ".") {
|
||||
// resolve as npm dependency
|
||||
var packagePath = "./node_modules/" + filename + "/package.json"
|
||||
|
|
@ -52,7 +52,7 @@ function run(input, output) {
|
|||
}
|
||||
}
|
||||
|
||||
function exportCode(filename, filepath, def, variable, eq, rest, uuid) {
|
||||
var exportCode = function(filename, filepath, def, variable, eq, rest, uuid) {
|
||||
var code = read(filepath)
|
||||
// if there's a syntax error, report w/ proper stack trace
|
||||
try {new Function(code)} catch (e) {
|
||||
|
|
@ -63,7 +63,7 @@ function run(input, output) {
|
|||
|
||||
// disambiguate collisions
|
||||
var ignored = {}
|
||||
code.replace(include, function(match, def, variable, eq, dep, rest) {
|
||||
code.replace(include, function(match, def, variable, eq, dep) {
|
||||
var filename = new Function("return " + dep).call()
|
||||
var binding = modules[resolve(filepath, filename)]
|
||||
if (binding != null) ignored[binding] = true
|
||||
|
|
@ -119,7 +119,7 @@ function run(input, output) {
|
|||
module.exports = function(input, output, options) {
|
||||
run(input, output)
|
||||
if (options && options.watch) {
|
||||
fs.watch(process.cwd(), {recursive: true}, function(file, type) {
|
||||
fs.watch(process.cwd(), {recursive: true}, function(file) {
|
||||
if (typeof file === "string" && path.resolve(output) !== path.resolve(file)) run(input, output)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ function ensureCodeIsHighlightable(file, data) {
|
|||
block = block.slice(3, -3)
|
||||
if (block.indexOf("javascript") !== 0) {
|
||||
try {if (new Function(block)) console.log(file + " - javascript block missing language tag after triple backtick\n\n" + block + "\n\n---\n\n")}
|
||||
catch (e) {}
|
||||
catch (e) {/*not a js block, ignore*/}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ function ensureCodeIsRunnable(file, data) {
|
|||
try {
|
||||
new Function("console,fetch,module,require", code).call(this, silentConsole, fetch, {exports: {}}, function(dep) {
|
||||
if (dep.indexOf("./mycomponent") === 0) return {view: function() {}}
|
||||
if (dep === "mithril") return m
|
||||
if (dep === "mithril") return global.m
|
||||
})
|
||||
}
|
||||
catch (e) {console.log(file + " - javascript code cannot run\n\n" + e.stack + "\n\n" + code + "\n\n---\n\n")}
|
||||
|
|
@ -93,7 +93,7 @@ global.document = window.document
|
|||
global.m = require("../index")
|
||||
|
||||
//run
|
||||
traverseDirectory("./docs", function(pathname, stat, children) {
|
||||
traverseDirectory("./docs", function(pathname) {
|
||||
if (pathname.indexOf(".md") > -1 && pathname.indexOf("migration") < 0) {
|
||||
fs.readFile(pathname, "utf8", function(err, data) {
|
||||
if (err) console.log(err)
|
||||
|
|
|
|||
23
mithril.js
23
mithril.js
|
|
@ -86,11 +86,11 @@ var _7 = function(log) {
|
|||
if (arguments.length > 0 && arguments[0] !== HALT) updateStream(stream, arguments[0], undefined)
|
||||
return stream._state.value
|
||||
}
|
||||
initStream(stream, arguments)
|
||||
initStream(stream)
|
||||
if (arguments.length > 0 && arguments[0] !== HALT) updateStream(stream, arguments[0], undefined)
|
||||
return stream
|
||||
}
|
||||
function initStream(stream, args) {
|
||||
function initStream(stream) {
|
||||
stream.constructor = createStream
|
||||
stream._state = {id: guid++, value: undefined, error: undefined, state: 0, derive: undefined, recover: undefined, deps: {}, parents: [], errorStream: undefined, endStream: undefined}
|
||||
stream.map = map, stream.ap = ap, stream.of = createStream
|
||||
|
|
@ -103,7 +103,7 @@ var _7 = function(log) {
|
|||
if (arguments.length > 0 && arguments[0] !== HALT) updateStream(stream, undefined, arguments[0])
|
||||
return stream._state.error
|
||||
}
|
||||
initStream(errorStream, [])
|
||||
initStream(errorStream)
|
||||
initDependency(errorStream, [stream], noop, noop)
|
||||
stream._state.errorStream = errorStream
|
||||
}
|
||||
|
|
@ -291,7 +291,6 @@ var buildQueryString = function(object) {
|
|||
else args.push(encodeURIComponent(key0) + (value1 != null && value1 !== "" ? "=" + encodeURIComponent(value1) : ""))
|
||||
}
|
||||
}
|
||||
var StreamFactory = _7
|
||||
var _9 = function($window, Stream0) {
|
||||
var callbackCount = 0
|
||||
var oncompletion
|
||||
|
|
@ -414,7 +413,7 @@ var _9 = function($window, Stream0) {
|
|||
return {request: request, jsonp: jsonp, setCompletionCallback: setCompletionCallback}
|
||||
}
|
||||
var requestService = _9(window, Stream)
|
||||
var _13 = function() {
|
||||
var _12 = function() {
|
||||
var callbacks = []
|
||||
function unsubscribe(callback) {
|
||||
var index0 = callbacks.indexOf(callback)
|
||||
|
|
@ -427,9 +426,9 @@ var _13 = function() {
|
|||
}
|
||||
return {subscribe: callbacks.push.bind(callbacks), unsubscribe: unsubscribe, publish: publish}
|
||||
}
|
||||
var redrawService = _13()
|
||||
var redrawService = _12()
|
||||
requestService.setCompletionCallback(redrawService.publish)
|
||||
var _15 = function($window) {
|
||||
var _14 = function($window) {
|
||||
var $doc = $window.document
|
||||
var $emptyFragment = $doc.createDocumentFragment()
|
||||
var onevent
|
||||
|
|
@ -937,7 +936,7 @@ var _15 = function($window) {
|
|||
}
|
||||
return {render: render, setEventCallback: setEventCallback}
|
||||
}
|
||||
var renderService = _15(window)
|
||||
var renderService = _14(window)
|
||||
var throttle = function(callback1) {
|
||||
//60fps translates to 16.6ms, round it down since setTimeout requires int
|
||||
var time = 16
|
||||
|
|
@ -971,7 +970,7 @@ var autoredraw = function(root, renderer, pubsub, callback0) {
|
|||
}
|
||||
return root.redraw = run1
|
||||
}
|
||||
var _19 = function(renderer, pubsub) {
|
||||
var _18 = function(renderer, pubsub) {
|
||||
return function(root, component) {
|
||||
if (component === null) {
|
||||
renderer.render(root, [])
|
||||
|
|
@ -988,7 +987,7 @@ var _19 = function(renderer, pubsub) {
|
|||
run0()
|
||||
}
|
||||
}
|
||||
m.mount = _19(renderService, redrawService)
|
||||
m.mount = _18(renderService, redrawService)
|
||||
var mount = m.mount
|
||||
var parseQueryString = function(string) {
|
||||
if (string === "" || string == null) return {}
|
||||
|
|
@ -1129,7 +1128,7 @@ var coreRouter = function($window) {
|
|||
}
|
||||
return {setPrefix: setPrefix, getPath: getPath, setPath: setPath, defineRoutes: defineRoutes, link: link}
|
||||
}
|
||||
var _25 = function($window, mount0) {
|
||||
var _24 = function($window, mount0) {
|
||||
var router = coreRouter($window)
|
||||
var currentResolve, currentComponent, currentRender, currentArgs, currentPath
|
||||
var RouteComponent = {view: function() {
|
||||
|
|
@ -1174,7 +1173,7 @@ var _25 = function($window, mount0) {
|
|||
route.get = function() {return currentPath}
|
||||
return route
|
||||
}
|
||||
m.route = _25(window, mount)
|
||||
m.route = _24(window, mount)
|
||||
m.withAttr = function(attrName, callback2, context) {
|
||||
return function(e) {
|
||||
return callback2.call(context || this, attrName in e.currentTarget ? e.currentTarget[attrName] : e.currentTarget.getAttribute(attrName))
|
||||
|
|
|
|||
4
mithril.min.js
vendored
4
mithril.min.js
vendored
|
|
@ -1,8 +1,8 @@
|
|||
new function(){function u(b,e,l,g,k,h){return{tag:b,key:e,attrs:l,children:g,text:k,dom:h,domSize:void 0,state:{},events:void 0,instance:void 0,skip:!1}}function w(b){if(null==b||"string"!==typeof b&&null==b.view)throw Error("The selector must be either a string or a component.");if("string"===typeof b&&void 0===G[b]){for(var e,l,g=[],k={};e=P.exec(b);){var h=e[1],q=e[2];""===h&&""!==q?l=q:"#"===h?k.id=q:"."===h?g.push(q):"["===e[3][0]&&((h=e[6])&&(h=h.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),
|
||||
k[e[4]]=h||!0)}0<g.length&&(k.className=g.join(" "));G[b]=function(b,f){var e=!1,h,g,q=b.className||b["class"],x;for(x in k)b[x]=k[x];void 0!==q&&(void 0!==b["class"]&&(b["class"]=void 0,b.className=q),void 0!==k.className&&(b.className=k.className+" "+q));for(x in b)if("key"!==x){e=!0;break}f instanceof Array&&1==f.length&&null!=f[0]&&"#"===f[0].tag?g=f[0].children:h=f;return u(l||"div",b.key,e?b:void 0,h,g,void 0)}}var t;null!=arguments[1]&&("object"!==typeof arguments[1]||void 0!==arguments[1].tag||
|
||||
arguments[1]instanceof Array)?g=1:(t=arguments[1],g=2);if(arguments.length===g+1)e=arguments[g]instanceof Array?arguments[g]:[arguments[g]];else for(e=[];g<arguments.length;g++)e.push(arguments[g]);return"string"===typeof b?G[b](t||{},u.normalizeChildren(e)):u(b,t&&t.key,t||{},u.normalizeChildren(e),void 0,void 0)}u.normalize=function(b){return b instanceof Array?u("[",void 0,void 0,u.normalizeChildren(b),void 0,void 0):null!=b&&"object"!==typeof b?u("#",void 0,void 0,b,void 0,void 0):b};u.normalizeChildren=
|
||||
function(b){for(var e=0;e<b.length;e++)b[e]=u.normalize(b[e]);return b};var P=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,G={};w.trust=function(b){return u("<",void 0,void 0,b,void 0,void 0)};w.fragment=function(b,e){return u("[",b.key,b,u.normalizeChildren(e),void 0,void 0)};var N=function(b){function e(){function a(){0<arguments.length&&arguments[0]!==D&&g(a,arguments[0],void 0);return a._state.value}l(a,arguments);0<arguments.length&&arguments[0]!==D&&g(a,arguments[0],
|
||||
void 0);return a}function l(a,c){a.constructor=e;a._state={id:Q++,value:void 0,error:void 0,state:0,derive:void 0,recover:void 0,deps:{},parents:[],errorStream:void 0,endStream:void 0};a.map=u;a.ap=w;a.of=e;a.valueOf=n;a.toJSON=H;a.toString=n;a.run=p;a["catch"]=A;Object.defineProperties(a,{error:{get:function(){if(!a._state.errorStream){var c=function(){0<arguments.length&&arguments[0]!==D&&g(a,void 0,arguments[0]);return a._state.error};l(c,[]);x(c,[a],L,L);a._state.errorStream=c}return a._state.errorStream}},
|
||||
function(b){for(var e=0;e<b.length;e++)b[e]=u.normalize(b[e]);return b};var P=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,G={};w.trust=function(b){return u("<",void 0,void 0,b,void 0,void 0)};w.fragment=function(b,e){return u("[",b.key,b,u.normalizeChildren(e),void 0,void 0)};var N=function(b){function e(){function a(){0<arguments.length&&arguments[0]!==D&&g(a,arguments[0],void 0);return a._state.value}l(a);0<arguments.length&&arguments[0]!==D&&g(a,arguments[0],
|
||||
void 0);return a}function l(a){a.constructor=e;a._state={id:Q++,value:void 0,error:void 0,state:0,derive:void 0,recover:void 0,deps:{},parents:[],errorStream:void 0,endStream:void 0};a.map=u;a.ap=w;a.of=e;a.valueOf=n;a.toJSON=H;a.toString=n;a.run=p;a["catch"]=A;Object.defineProperties(a,{error:{get:function(){if(!a._state.errorStream){var c=function(){0<arguments.length&&arguments[0]!==D&&g(a,void 0,arguments[0]);return a._state.error};l(c);x(c,[a],L,L);a._state.errorStream=c}return a._state.errorStream}},
|
||||
end:{get:function(){if(!a._state.endStream){var c=e();c.map(function(d){!0===d&&(z(a),z(c));return d});a._state.endStream=c}return a._state.endStream}}})}function g(a,c,d){k(a,c,d);for(var f in a._state.deps)q(a._state.deps[f],!1);a._state.changed=!1;for(var b in a._state.deps)a._state.deps[b]._state.changed=!1}function k(a,c,d){d=r(c,d);if(void 0!==d&&"function"===typeof a._state.recover){if(!t(a,h,!0))return}else h(a,c,d);a._state.changed=!0;2!==a._state.state&&(a._state.state=1)}function h(a,c,
|
||||
d){a._state.value=c;a._state.error=d}function q(d,f){var b=d._state.parents;0<b.length&&b.filter(c).length===b.length&&(f||0<b.filter(a).length)&&(b=b.filter(M),0<b.length?k(d,void 0,b[0]._state.error):t(d,k,!1))}function t(a,c,d){try{var b=d?a._state.recover():a._state.derive();if(b===D)return!1;c(a,b,void 0)}catch(e){c(a,void 0,null!=e.__error?e.__error:e),null==e.__error&&f(a,e)}return!0}function r(a,c){null!=a&&a.constructor===e&&(c=void 0!==a._state.error?a._state.error:r(a._state.value,a._state.error));
|
||||
return c}function f(a,c){0===Object.keys(a._state.deps).length&&setTimeout(function(){0===Object.keys(a._state.deps).length&&b(c)},0)}function p(a){var c=e(),d=this;return x(c,[d],function(){return B(c,a(d()))},void 0)}function A(a){var c=e(),d=this;return x(c,[d],function(){return d._state.value},function(){return B(c,a(d._state.error))})}function m(c,d){if(d.length>d.filter(E).length)throw Error("Ensure that each item passed to m.prop.combine/m.prop.merge is a stream");return x(e(),d,function(){var b=
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ require.$$current = function() {
|
|||
return src.replace(/\.js$/, "")
|
||||
}
|
||||
|
||||
var module = {
|
||||
window.module = {
|
||||
get exports() {return require.$$modules[require.$$current()]},
|
||||
set exports(value) {require.$$modules[require.$$current()] = value},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ module.exports = new function init() {
|
|||
function define(name, verb, compare) {
|
||||
Assert.prototype[name] = function assert(value) {
|
||||
if (compare(this.value, value)) record(null)
|
||||
else record(serialize(this.value) + " " + verb + " " + serialize(value))
|
||||
else record(serialize(this.value) + "\n" + verb + "\n" + serialize(value))
|
||||
return function(message) {
|
||||
var result = results[results.length - 1]
|
||||
result.message = message + "\n\n" + result.message
|
||||
|
|
@ -198,7 +198,7 @@ module.exports = new function init() {
|
|||
for (var i = 0, r; r = results[i]; i++) {
|
||||
if (!r.pass) {
|
||||
var stackTrace = r.error.match(/^(?:(?!Error|[\/\\]ospec[\/\\]ospec\.js).)*$/m)
|
||||
console.error(r.context + ": " + highlight(r.message) + (stackTrace ? "\n\n" + stackTrace + "\n\n" : ""), hasProcess ? "" : "color:red", hasProcess ? "" : "color:black")
|
||||
console.error(r.context + ":\n" + highlight(r.message) + (stackTrace ? "\n\n" + stackTrace + "\n\n" : ""), hasProcess ? "" : "color:red", hasProcess ? "" : "color:black")
|
||||
status = 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ Promise.prototype.catch = function(onRejection) {
|
|||
}
|
||||
Promise.resolve = function(value) {
|
||||
if (value instanceof Promise) return value
|
||||
return new Promise(function(resolve, reject) {resolve(value)})
|
||||
return new Promise(function(resolve) {resolve(value)})
|
||||
}
|
||||
Promise.reject = function(value) {
|
||||
return new Promise(function(resolve, reject) {reject(value)})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"use strict"
|
||||
|
||||
var buildQueryString = require("../querystring/build")
|
||||
var StreamFactory = require("../util/stream")
|
||||
|
||||
module.exports = function($window, Stream) {
|
||||
var callbackCount = 0
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ module.exports = function(log) {
|
|||
if (arguments.length > 0 && arguments[0] !== HALT) updateStream(stream, arguments[0], undefined)
|
||||
return stream._state.value
|
||||
}
|
||||
initStream(stream, arguments)
|
||||
initStream(stream)
|
||||
|
||||
if (arguments.length > 0 && arguments[0] !== HALT) updateStream(stream, arguments[0], undefined)
|
||||
|
||||
return stream
|
||||
}
|
||||
function initStream(stream, args) {
|
||||
function initStream(stream) {
|
||||
stream.constructor = createStream
|
||||
stream._state = {id: guid++, value: undefined, error: undefined, state: 0, derive: undefined, recover: undefined, deps: {}, parents: [], errorStream: undefined, endStream: undefined}
|
||||
stream.map = map, stream.ap = ap, stream.of = createStream
|
||||
|
|
@ -27,7 +27,7 @@ module.exports = function(log) {
|
|||
if (arguments.length > 0 && arguments[0] !== HALT) updateStream(stream, undefined, arguments[0])
|
||||
return stream._state.error
|
||||
}
|
||||
initStream(errorStream, [])
|
||||
initStream(errorStream)
|
||||
initDependency(errorStream, [stream], noop, noop)
|
||||
stream._state.errorStream = errorStream
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue