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.
ab-test-service
Advanced tools
Readme
An AngularJS service for creating imperative A/B/n tests in your AngularJS projects. This service makes no assumptions about how your application is set up or how you want to use it. While for most applications a single A/B test service created at config time will be all you need. There's no reason you can't lazily create the A/B test service, or have multiple instances.
bower install ab-test-service
ab-svc.js
script provided by this component into your app.ab.test.service
as a module dependency to your app.This module exposes a abMfg
(factory), which is an API for instantiating
A/B tests that are integrated with Angular's digest cycle.
// create module with ab.test.service dependency
var demo = angular.module('demo', ['ab.test.service']);
// create a/b test service instance
demo.factory('ab', function(abMfg) {
return abMfg();
});
With that, you can inject your ab
service into controllers and
other services anywhere in your application!
Building on the example above (see demo for full context):
// use ab test service in a controller
demo.controller('abTestCtrl', ['$scope', 'ab', function($scope, ab) {
// look up the button element
var btn = document.getElementById('example');
// run a/b test to select css class name
var cssClass = ab.test(['default','primary','success','info','warning','danger','link'], 1);
// update the ui
btn.className = 'btn btn-lg btn-' + cssClass;
// log variant shown (example)
//AB.log({shown:cssClass}, "http://www.example.com/log");
// provide a go button to the repo
$scope.go = function () {
// log variant chosen & use optional callback to ensure the page is not left before log completes
AB.log({chose:cssClass}, "http://www.example.com/log", function(e) {
// example of checking the event type
if (e.type === "error") {
// unable to log a/b test results :(
} else {
// a/b test results logged! :)
}
// continue to the repo
location = 'https://github.com/daniellmb/ab-test-service';
});
}
}]);
The ab.js 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.
Run npm install
to make sure you have all the development dependencies.
Run npm test
to make run all the unit tests.
If you make changes to ab-svc.js file:
Run npm run gulp
to update the .min.js and .map files.
(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
An AngularJS service for creating imperative A/B/n tests in your AngularJS projects.
The npm package ab-test-service receives a total of 1 weekly downloads. As such, ab-test-service popularity was classified as not popular.
We found that ab-test-service 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.