can-data-types
Advanced tools
Comparing version
@@ -11,21 +11,21 @@ var dataTypes = require("./can-data-types"); | ||
QUnit.test('MaybeBoolean', function(){ | ||
QUnit.equal( canReflect.convert("true", dataTypes.MaybeBoolean), true, "converted"); | ||
QUnit.test('MaybeBoolean', function(assert) { | ||
assert.equal( canReflect.convert("true", dataTypes.MaybeBoolean), true, "converted"); | ||
QUnit.equal(canReflect.new(dataTypes.MaybeBoolean, "true") , true); | ||
assert.equal(canReflect.new(dataTypes.MaybeBoolean, "true") , true); | ||
QUnit.equal(dataTypes.MaybeBoolean[Symbol.for("can.isMember")](true) , true); | ||
QUnit.equal(dataTypes.MaybeBoolean[Symbol.for("can.isMember")]("true") , false); | ||
QUnit.equal(dataTypes.MaybeBoolean[Symbol.for("can.isMember")](null) , true); | ||
assert.equal(dataTypes.MaybeBoolean[Symbol.for("can.isMember")](true) , true); | ||
assert.equal(dataTypes.MaybeBoolean[Symbol.for("can.isMember")]("true") , false); | ||
assert.equal(dataTypes.MaybeBoolean[Symbol.for("can.isMember")](null) , true); | ||
}); | ||
QUnit.test('MaybeDate', function(){ | ||
QUnit.test('MaybeDate', function(assert) { | ||
var date = new Date(2018,0,1); | ||
QUnit.equal( canReflect.convert(date.toString(), dataTypes.MaybeDate).getTime(), date.getTime(), "converted"); | ||
assert.equal( canReflect.convert(date.toString(), dataTypes.MaybeDate).getTime(), date.getTime(), "converted"); | ||
QUnit.deepEqual(canReflect.new(dataTypes.MaybeDate, "2018-1-31") , new Date( Date.parse("2018-1-31") ), "new" ); | ||
assert.deepEqual(canReflect.new(dataTypes.MaybeDate, "2018-1-31") , new Date( Date.parse("2018-1-31") ), "new" ); | ||
QUnit.equal(dataTypes.MaybeDate[Symbol.for("can.isMember")](new Date()) , true); | ||
QUnit.equal(dataTypes.MaybeDate[Symbol.for("can.isMember")]({}) , false); | ||
QUnit.equal(dataTypes.MaybeDate[Symbol.for("can.isMember")](null) , true); | ||
assert.equal(dataTypes.MaybeDate[Symbol.for("can.isMember")](new Date()) , true); | ||
assert.equal(dataTypes.MaybeDate[Symbol.for("can.isMember")]({}) , false); | ||
assert.equal(dataTypes.MaybeDate[Symbol.for("can.isMember")](null) , true); | ||
@@ -35,21 +35,21 @@ | ||
QUnit.test('MaybeNumber', function(){ | ||
QUnit.equal( canReflect.convert("5", MaybeNumber), 5, "converted"); | ||
QUnit.test('MaybeNumber', function(assert) { | ||
assert.equal( canReflect.convert("5", MaybeNumber), 5, "converted"); | ||
QUnit.equal( canReflect.new(MaybeNumber, "1"), 1); | ||
assert.equal( canReflect.new(MaybeNumber, "1"), 1); | ||
QUnit.equal( MaybeNumber[isMemberSymbol](1) , true); | ||
QUnit.equal( MaybeNumber[isMemberSymbol]("1") , false); | ||
QUnit.equal( MaybeNumber[isMemberSymbol](null) , true); | ||
assert.equal( MaybeNumber[isMemberSymbol](1) , true); | ||
assert.equal( MaybeNumber[isMemberSymbol]("1") , false); | ||
assert.equal( MaybeNumber[isMemberSymbol](null) , true); | ||
}); | ||
QUnit.test('MaybeString', function(){ | ||
QUnit.equal( canReflect.convert(1, dataTypes.MaybeString), "1", "converted"); | ||
QUnit.test('MaybeString', function(assert) { | ||
assert.equal( canReflect.convert(1, dataTypes.MaybeString), "1", "converted"); | ||
QUnit.equal( canReflect.new(dataTypes.MaybeString, 1) , "1"); | ||
assert.equal( canReflect.new(dataTypes.MaybeString, 1) , "1"); | ||
QUnit.equal( dataTypes.MaybeString[Symbol.for("can.isMember")]("1") , true); | ||
QUnit.equal( dataTypes.MaybeString[Symbol.for("can.isMember")](1) , false); | ||
QUnit.equal( dataTypes.MaybeString[Symbol.for("can.isMember")](null) , true); | ||
assert.equal( dataTypes.MaybeString[Symbol.for("can.isMember")]("1") , true); | ||
assert.equal( dataTypes.MaybeString[Symbol.for("can.isMember")](1) , false); | ||
assert.equal( dataTypes.MaybeString[Symbol.for("can.isMember")](null) , true); | ||
}); |
{ | ||
"name": "can-data-types", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Reusable special data types", | ||
@@ -52,8 +52,8 @@ "homepage": "", | ||
"jshint": "^2.9.1", | ||
"steal": "^1.6.5", | ||
"steal-qunit": "^1.0.1", | ||
"steal-tools": "^1.11.3", | ||
"testee": "^0.7.0" | ||
"steal": "^2.2.1", | ||
"steal-qunit": "^2.0.0", | ||
"steal-tools": "^2.2.1", | ||
"testee": "^0.9.0" | ||
}, | ||
"license": "MIT" | ||
} |
# can-data-types | ||
[](https://travis-ci.org/canjs/can-data-types) | ||
[](https://www.bitovi.com/community/slack?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[](https://forums.bitovi.com/?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[](https://github.com/canjs/can-data-types/blob/master/LICENSE) | ||
[](https://www.npmjs.com/package/can-data-types) | ||
[](https://travis-ci.org/canjs/can-data-types) | ||
[](https://greenkeeper.io/) | ||
Reusable special data types | ||
## Usage | ||
## Documentation | ||
### ES6 use | ||
Read the [can-data-types API docs on CanJS.com](https://canjs.com/doc/can-data-types.html). | ||
With StealJS, you can import this module directly in a template that is autorendered: | ||
## Changelog | ||
```js | ||
import plugin from 'can-data-types'; | ||
``` | ||
See the [latest releases on GitHub](https://github.com/canjs/can-data-types/releases). | ||
### CommonJS use | ||
## Contributing | ||
Use `require` to load `can-data-types` and everything else | ||
needed to create a template that uses `can-data-types`: | ||
The [contribution guide](https://github.com/canjs/can-data-types/blob/master/CONTRIBUTING.md) has information on getting help, reporting bugs, developing locally, and more. | ||
```js | ||
var plugin = require("can-data-types"); | ||
``` | ||
## License | ||
### Standalone use | ||
Load the `global` version of the plugin: | ||
```html | ||
<script src='./node_modules/can-data-types/dist/global/can-data-types.js'></script> | ||
``` | ||
[MIT](https://github.com/canjs/can-data-types/blob/master/LICENSE) |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
17398
4.6%27
-18.18%