Comparing version 2.0.0 to 3.0.0
// Generated by LiveScript 1.4.0 | ||
(function(){ | ||
var request, util, stop, slice$ = [].slice; | ||
var request, util, extend, curry, stoptions, slice$ = [].slice; | ||
request = require('request'); | ||
util = require('util'); | ||
stop = curry$(function(token, chat_id, options){ | ||
var ref$; | ||
request.post({ | ||
uri: "https://api.telegram.org/bot" + token + "/sendMessage", | ||
form: (ref$ = import$({}, options), ref$.chat_id = chat_id, ref$) | ||
}, function(){}); | ||
return stop(token, chat_id); | ||
extend = require('extend'); | ||
module.exports = function(it){ | ||
switch (typeof it) { | ||
case 'string': | ||
return curry.apply(this, arguments); | ||
case 'object': | ||
return stoptions.apply(this, arguments); | ||
default: | ||
throw new Error('First parameter must be options or a token'); | ||
} | ||
}; | ||
curry = curry$(function(token, chat_id){ | ||
return stoptions.apply(null, [{ | ||
token: token, | ||
params: { | ||
chat_id: chat_id | ||
} | ||
}].concat(slice$.call(slice$.call(arguments, 2, -1 + 1 || 9e9)))); | ||
}); | ||
module.exports = curry$(function(token, chat_id, output){ | ||
var that; | ||
if (token == null) { | ||
return module.exports; | ||
stoptions = function(it){ | ||
var options, that, chat_id, x$, stopit; | ||
options = extend(true, {}, it); | ||
if (options.token == null) { | ||
throw new Error("Missing 'token' option"); | ||
} | ||
token = token.trim(); | ||
if (that = /^(?:(?:.*\/)?bot)?([^\/]*)(?:\/.*)?$/.exec(token)) { | ||
token = that[1]; | ||
if (that = /(?:bot)?(\d+:[-\w]+)/.exec(options.token)) { | ||
options.token = that[1]; | ||
} else { | ||
throw new Error("Invalid token: " + options.token); | ||
} | ||
if (chat_id == null) { | ||
return module.exports(token); | ||
if (options.params == null) { | ||
throw new Error("Missing 'params' option"); | ||
} | ||
if (output === module.exports) { | ||
return stop.apply(null, [token, chat_id].concat(slice$.call(slice$.call(arguments, 3, -1 + 1 || 9e9)))); | ||
if (options.params.chat_id == null) { | ||
throw new Error("Missing 'chat_id' parameter"); | ||
} | ||
stop(token, chat_id, { | ||
text: util.format.apply(util, slice$.call(arguments, 2, -1 + 1 || 9e9)) | ||
if (!isNaN(chat_id = parseInt(options.params.chat_id))) { | ||
options.params.chat_id = chat_id; | ||
} else { | ||
throw new Error("Invalid chat_id: " + options.params.chat_id); | ||
} | ||
x$ = stopit = function(it){ | ||
return it; | ||
}( | ||
function(){ | ||
request.post({ | ||
url: "https://api.telegram.org/bot" + options.token + "/sendMessage", | ||
form: extend(true, {}, options.params, { | ||
text: bind$(util, 'format').apply(this, arguments) | ||
}) | ||
}, function(){}); | ||
return stopit; | ||
}); | ||
return module.exports(token, chat_id); | ||
}); | ||
function import$(obj, src){ | ||
var own = {}.hasOwnProperty; | ||
for (var key in src) if (own.call(src, key)) obj[key] = src[key]; | ||
return obj; | ||
} | ||
x$.now = function(it){ | ||
return stoptions.apply(null, [extend(true, {}, options, it)].concat(slice$.call(slice$.call(arguments, 1, -1 + 1 || 9e9)))); | ||
}; | ||
if (arguments.length > 1) { | ||
x$.apply(null, slice$.call(arguments, 1, -1 + 1 || 9e9)); | ||
} | ||
return x$; | ||
}; | ||
function curry$(f, bound){ | ||
@@ -52,2 +80,5 @@ var context, | ||
} | ||
function bind$(obj, key, target){ | ||
return function(){ return (target || obj)[key].apply(obj, arguments) }; | ||
} | ||
}).call(this); |
{ | ||
"name": "stopstop", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "simple telegram output passer", | ||
@@ -12,3 +12,3 @@ "main": "lib/index.js", | ||
"postpublish": "npm run clean", | ||
"test": "lsc test/~" | ||
"test": "lsc test" | ||
}, | ||
@@ -40,2 +40,3 @@ "repository": { | ||
"dependencies": { | ||
"extend": "^3.0.0", | ||
"request": "^2.69.0" | ||
@@ -42,0 +43,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83
4444
2
3
2
0
+ Addedextend@^3.0.0