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

@nexssp/data

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nexssp/data - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

19

lib/data.js

@@ -70,2 +70,19 @@ const _log = require('@nexssp/logdebug')

// Maybe there is better function, this works for us.
function isJson(item) {
item = typeof item !== 'string' ? JSON.stringify(item) : item
try {
item = JSON.parse(item)
} catch (e) {
return false
}
if (typeof item === 'object' && item !== null) {
return true
}
return false
}
const isFile = (v) => {

@@ -97,2 +114,4 @@ const stat = lstatSync(v)

return v.startsWith('http://') || v.startsWith('https://')
case 'json':
return isJson(v)
default:

@@ -99,0 +118,0 @@ break

1

lib/valid-datatypes.js

@@ -40,4 +40,5 @@ const stream = require('stream')

url: () => ['https://abc.ce', 'https://abc.de'],
json: () => ['{"x":1}', '{"val":{"nested":5}}'],
// Exists: () => [`${__dirname}/guard.js`, `${__dirname}/../datatype`],
// async *[Symbol.asyncIterator]() {}
}

2

package.json
{
"name": "@nexssp/data",
"main": "lib/data.js",
"version": "1.0.2",
"version": "1.0.3",
"description": "Checking and comparing datatypes",

@@ -6,0 +6,0 @@ "keywords": [

@@ -32,4 +32,4 @@ # @nexssp/data

- **type (value)** -> return one of the datatype: **object, string, array, number, boolean, undefined, function, null, map, set, generatorfunction, promise, stream**
- **is (type, value)** -> check for the types + **is('directory',v)**, **is('dir',v)**, **is('file',v)**
- **type (value)** -> return one of the datatype: **object, string, array, number, boolean, undefined, function, null, map, set, generatorfunction, promise, stream, url, json**
- **is (type, value)** -> check for the types + **is('directory',v)**, **is('dir',v)**, **is('file',v), **is('url',v), , **is('json',v)**
- **compare (v1, v2)** -> compares 2 values. If any of them is function, it will run first and then compare

@@ -78,3 +78,4 @@ - **isEmpty (value)** -> check if anything is empty like array, object, string.

url: () => ['https://abc.com', 'http://abc.com'],
json: () => ['{"x":1}', '{"val":{"nested":5}}'],
}
```
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