Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
Make user-driven decisions with this 214 byte A/B test micro-library, that is completely self contained with no external dependencies. Use ab.js to choose a cryptographically random A/B test variant and log the results to your database. How you analyze the actionable data is up to you. Testing different versions of copy text, layouts, images and colors in the browser has never been more simple.
The library consists of two parts the A/B tester (ab.js) and the logger (log.js). These are separate to enable you to choose the best tools based on your environment. Say for example you already have jQuery on the page and want to use that for logging data, great, then all you need to include is ab.js.
// 100% of the time this a/b test will run
var ab = AB.test(['a','b'], 1);
// use a JSON object to log any values you need
AB.log({shown:ab}, 'http://example.com/log');
// customize the frequency setting
// 50% of the time this a/b test will run
var ab = AB.test(['a','b'], 0.5);
// check if we should run the test
if (ab) {
AB.log({shown:ab}, 'http://example.com/log');
}
// use any number of variants
// one thousandth of the time this a/b test will run
var ab = AB.test(['a','b','c'], 0.001);
if (ab) {
AB.log({shown:ab}, 'http://example.com/log');
}
Supported Methods
Tested Environments
By default the two methods are assigned to the window
object under the namespace AB
. If you don't want the methods added there, simply modify the immediate function to pass in the JavaScript object of your choosing, and the namespace you want them exported under.
AB.test (Array
variants, Number
frequency)
summary:
example:
Run an A/B test on the values red, green and refactor. The variable "ab" will always be either red or green or refactor, but never null because the frequency is set to 1 (always run the test).
var ab = AB.test(['red','green','refactor'], 1);
console.log(ab);
variants: Array
frequency: Number
float
between 0.0001 and 1, for example:
1
will always run the a/b test0.5
will run the test 50% of the time0.2
will run the test two out of ten times0.001
will run the test one thousandth of the timereturns: Value
or Null
value
from the variants array or null
if the test should not be run.AB.log (Object
data, String
url, Function
callback)
summary: - The log method uses an image request to send data to your servers. This allows the code to work even on different websites and protocols by avoiding the cross-origin security restrictions with using AJAX.
example:
send foo=bar to example.com
AB.log({foo:"bar"}, "http://www.example.com");
data: Object
url: String
callback: Function
returns: undefined
(The MIT License)
Copyright (c) 2014 Daniel Lamb <daniellmb.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
0.2kb A/B/n Testing micro-library
The npm package ab.js receives a total of 3 weekly downloads. As such, ab.js popularity was classified as not popular.
We found that ab.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.