Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ node_modules
npm-debug.log

coverage.html

dist
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## 2.0.0

* Convert project to an ES module

## 1.0.0

* makefile: cleanup
* add node 0.10
* cleaning up:
* readme
* add tests
* lib: export assert function
* deps: add assertion-error
* "Initial commit"
12 changes: 0 additions & 12 deletions History.md

This file was deleted.

46 changes: 0 additions & 46 deletions Makefile

This file was deleted.

18 changes: 0 additions & 18 deletions component.json

This file was deleted.

41 changes: 7 additions & 34 deletions index.js → index.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
/*!
* simple-assert
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/

/*!
* Module dependencies
*/

var AssertionError = require('assertion-error');

/*!
* Primary export
*/

var exports = module.exports = assert;

/*!
* Expose AssertionError constructor
*/

exports.AssertionError = AssertionError;
import {AssertionError} from 'assertion-error'

/**
* ### assert (expr[, msg])
Expand All @@ -34,14 +12,12 @@ exports.AssertionError = AssertionError;
* assert('string', 'string is truthy');
* ```
*
* @param {Mixed} expression to test for truthiness
* @param {String} message on failure
* @throws AssertionError
*/

function assert (expr, msg, ssf) {
export function assert (expr: unknown, msg: string) {
if (!expr) {
throw new AssertionError(msg || 'Assertion Failed', null, ssf || arguments.callee);
throw new AssertionError(msg || 'Assertion Failed');
}
}

Expand All @@ -57,13 +33,11 @@ function assert (expr, msg, ssf) {
* });
* ```
*
* @param {Mixed} express to test for falsiness
* @param {String} messag eon failure
* @throws AssertionError
*/

exports.not = function (expr, msg) {
assert(!expr, msg, arguments.callee);
export function not (expr: unknown, msg: string) {
assert(!expr, msg);
};

/**
Expand All @@ -84,10 +58,9 @@ exports.not = function (expr, msg) {
* }
* ```
*
* @param {String} failure message
* @throws AssertionError
*/

exports.fail = function (msg) {
assert(false, msg, arguments.callee);
export function fail(msg: string) {
assert(false, msg);
};
14 changes: 14 additions & 0 deletions karma.conf.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = function configureKarma(config) {
config.set({
basePath: '.',
browsers: ['ChromeHeadless'],
frameworks: [ 'mocha' ],
files: [
{ pattern: './dist/bundled.js', included: false },
{ pattern: './dist/bundled.test.js', type: 'module' }
],
colors: true,
autoWatch: false,
singleRun: true
});
};
Loading