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

json-expressible

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-expressible - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

.github/workflows/built-test-deploy.yml

10

index.js

@@ -6,7 +6,7 @@ var check = require("check-types");

var jsonExpressible = function(val) {
var jsonExpressible = function (val) {
return !hasCircular(val, []) && onlyJsonValues(val);
};
var onlyJsonValues = function(val) {
var onlyJsonValues = function (val) {
if (

@@ -21,3 +21,3 @@ check.string(val) ||

var ret = true;
_each(val, function(subval) {
_each(val, function (subval) {
ret = onlyJsonValues(subval);

@@ -32,3 +32,3 @@ return ret; // stop if bad

var hasCircular = function(value, ancestors) {
var hasCircular = function (value, ancestors) {
if (!check.object(value) && !check.array(value)) {

@@ -45,3 +45,3 @@ return false;

var ret = false;
_each(value, function(child) {
_each(value, function (child) {
ret = hasCircular(child, newAncestors);

@@ -48,0 +48,0 @@ return !ret; // stop if bad

{
"name": "json-expressible",
"version": "1.0.2",
"version": "1.0.3",
"description": "Micro library that determines whether a value can be expressed as JSON.",

@@ -23,14 +23,14 @@ "main": "index.js",

"dependencies": {
"check-types": "^10.0.0",
"ghooks": "^2.0.4",
"lodash": "^4.17.15"
"check-types": "^11.2.3",
"lodash": "^4.17.21"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-config-prettier": "^3.1.0",
"eslint-plugin-es5": "^1.3.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-prettier": "^3.0.1",
"jasmine": "^3.4.0",
"prettier": "^1.14.3"
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-es5": "^1.5.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"ghooks": "^2.0.4",
"jasmine": "^5.1.0",
"prettier": "^3.2.4"
},

@@ -37,0 +37,0 @@ "config": {

@@ -1,2 +0,2 @@

[![Build Status](https://travis-ci.com/aarong/json-expressible.svg?branch=master)](https://travis-ci.com/github/aarong/json-expressible)
[![CI-CD](https://github.com/aarong/json-expressible/actions/workflows/built-test-deploy.yml/badge.svg)](https://github.com/aarong/json-expressible/actions/workflows/built-test-deploy.yml)

@@ -3,0 +3,0 @@ # JSON-Expressible

var jsonExpressible = require(".");
describe("The jsonExpressible() function", function() {
it("should return correctly for non-objects/arrays", function() {
describe("The jsonExpressible() function", function () {
it("should return correctly for non-objects/arrays", function () {
expect(jsonExpressible(null)).toBe(true);

@@ -12,3 +12,3 @@ expect(jsonExpressible("string")).toBe(true);

expect(jsonExpressible(NaN)).toBe(false);
expect(jsonExpressible(function() {})).toBe(false);
expect(jsonExpressible(function () {})).toBe(false);
expect(jsonExpressible(new Date())).toBe(false);

@@ -23,3 +23,3 @@ expect(jsonExpressible(Infinity)).toBe(false);

it("should return correctly for objects", function() {
it("should return correctly for objects", function () {
expect(jsonExpressible({ a: 123 })).toBe(true);

@@ -33,3 +33,3 @@ expect(jsonExpressible({ a: undefined })).toBe(false);

it("should return correctly for arrays", function() {
it("should return correctly for arrays", function () {
expect(jsonExpressible([123])).toBe(true);

@@ -43,3 +43,3 @@ expect(jsonExpressible([undefined])).toBe(false);

it("should correctly detect circular references", function() {
it("should correctly detect circular references", function () {
expect(jsonExpressible({ a: true, b: 123 })).toBe(true);

@@ -79,3 +79,3 @@ expect(jsonExpressible([true, 123])).toBe(true);

it("sample code should work", function() {
it("sample code should work", function () {
// The following return true

@@ -94,3 +94,3 @@

console.log(jsonExpressible(NaN));
console.log(jsonExpressible(function() {}));
console.log(jsonExpressible(function () {}));
console.log(jsonExpressible(new Date()));

@@ -97,0 +97,0 @@ console.log(jsonExpressible(Infinity));

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