0.2.0 move to native esm
parent
41e2df91eb
commit
3ab7d35639
|
@ -1,17 +1,15 @@
|
|||
import Ready from '../src/ready'
|
||||
import { EventEmitter } from 'events'
|
||||
import toBooleanDefault from '../src/boolean.js'
|
||||
import { toBoolean, createBoolean, rTrue, rFalse } from '../src/boolean.js'
|
||||
|
||||
let emitter = new EventEmitter()
|
||||
const boolean=toBoolean()
|
||||
console.log(rTrue)
|
||||
console.log(rFalse)
|
||||
console.log('nope',toBoolean('nope'))
|
||||
console.log('yes',toBoolean('yes'))
|
||||
console.log('undefined',toBoolean(undefined))
|
||||
console.log('null',toBoolean('null'))
|
||||
console.log('0',toBoolean(0))
|
||||
console.log(toBoolean('yes'))
|
||||
console.log('-1',toBoolean(-1))
|
||||
console.log('1', toBoolean(1))
|
||||
|
||||
let process = new Ready({emitter: emitter, condition: (ev=> {return ev===true}) })
|
||||
|
||||
process.addObserver('one')
|
||||
process.addObserver('two')
|
||||
process.addObserver('three')
|
||||
|
||||
process.subscribe()
|
||||
|
||||
emitter.emit('one',true)
|
||||
emitter.emit('two',true)
|
||||
emitter.emit('three',true)
|
||||
emitter.emit('one',false)
|
||||
|
|
18
package.json
18
package.json
|
@ -1,13 +1,14 @@
|
|||
{
|
||||
"name": "@uci-utils/to-boolean",
|
||||
"version": "0.1.5",
|
||||
"version": "0.2.0",
|
||||
"description": "function to return a boolean value from sets of default values",
|
||||
"main": "src/boolean.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"example": "node -r esm examples/example",
|
||||
"example:dev": "UCI_ENV=dev ./node_modules/.bin/nodemon -r esm examples/example",
|
||||
"test": "./node_modules/.bin/mocha -r esm --timeout 30000 || exit 0",
|
||||
"testd": "./node_modules/.bin/nodemon --exec './node_modules/.bin/mocha -r esm --timeout 30000' || exit 0"
|
||||
"example": "node examples/example",
|
||||
"example:dev": "UCI_ENV=dev ./node_modules/.bin/nodemon examples/example",
|
||||
"test": "./node_modules/.bin/mocha --timeout 30000 || exit 0",
|
||||
"testd": "./node_modules/.bin/nodemon --exec './node_modules/.bin/mocha --timeout 30000' || exit 0"
|
||||
},
|
||||
"author": "David Kebler",
|
||||
"license": "MIT",
|
||||
|
@ -24,9 +25,8 @@
|
|||
"homepage": "https://github.com/uCOMmandIt/uci-utils#readme",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"esm": "^3.2.25",
|
||||
"mocha": "^6.2.2",
|
||||
"nodemon": "^1.19.4"
|
||||
"chai": "^4.3.4",
|
||||
"mocha": "^8.3.2",
|
||||
"nodemon": "^2.0.7"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
let rTrue=['t','true','y','yes','on','positive','up','enabled','affirmative','yea','sure','online','set','closed']
|
||||
let rFalse=['f','false','n','no','off','negative','down','disabled','nope','offline','unset','open']
|
||||
let rTrue=['t','true','y','yes','on','affirmative','positive','up','enabled','affirmative','yea','yep','sure','online','set','closed']
|
||||
let rFalse=['f','false','n','no','off','negative','negatory','down','disabled','nope','offline','unset','open']
|
||||
|
||||
function createBoolean (opts={}) {
|
||||
return (value => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from 'chai'
|
||||
import {toBoolean, createBoolean, rTrue,rFalse }from '../src/boolean'
|
||||
import {toBoolean, createBoolean, rTrue,rFalse } from '../src/boolean.js'
|
||||
|
||||
describe('No options default function check - ', function () {
|
||||
it('should return false for undefined', function () {
|
||||
|
|
Loading…
Reference in New Issue