Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

baiji-normalizer

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baiji-normalizer - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

17

index.js

@@ -139,2 +139,3 @@ /**

* boolean
* object
* any

@@ -257,7 +258,4 @@ */

/**
* any converter
* any => any
*/
Normalizer.define('any', function convertAny(val, opts) {
// convert object/any type
function convertAny(val, opts) {
if (!opts) opts = {};

@@ -267,2 +265,9 @@ // use maxCoerceLevel to prevent circular reference parse error

return coerceAll(val, maxCoerceLevel);
});
}
/**
* object/any converter
* object/any => object/any
*/
Normalizer.define('any', convertAny);
Normalizer.define('object', convertAny);
{
"name": "baiji-normalizer",
"version": "1.0.3",
"version": "1.0.4",
"description": "Baiji Normalizer",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,3 +20,3 @@ Baiji Normalizer

// Built-in Types
// number, string, date, boolean
// number, string, date, boolean, object, any

@@ -23,0 +23,0 @@

@@ -70,2 +70,3 @@ var chai = require('chai');

it('should be converted as any', function() {

@@ -89,2 +90,20 @@ expect(new Normalizer(undefined).to('any')).to.equal(undefined);

it('should be converted as object', function() {
expect(new Normalizer(undefined).to('object')).to.equal(undefined);
expect(new Normalizer('undefined').to('object')).to.equal(undefined);
expect(new Normalizer(null).to('object')).to.equal(null);
expect(new Normalizer('null').to('object')).to.equal(null);
expect(new Normalizer('123').to('object')).to.equal(123);
expect(new Normalizer(123).to('object')).to.equal(123);
expect(new Normalizer([123]).to('object')).to.eql([123]);
expect(new Normalizer({ a: 1 }).to('object')).to.eql({ a: 1 });
expect(new Normalizer({ a: '1' }).to('object')).to.eql({ a: 1 });
var circularExample = {};
circularExample.anotherCircularReference = circularExample;
expect(function() {
new Normalizer(circularExample).to('object');
}).not.to.throw(Error);
});
it('should be converted as boolean', function() {

@@ -91,0 +110,0 @@ expect(new Normalizer(undefined).to('boolean')).to.equal(undefined);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc