New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

object-to-schema

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-to-schema - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="1.5.0"></a>
# [1.5.0](https://github.com/forsigner/object-to-schema/compare/v1.4.0...v1.5.0) (2017-12-29)
### Features
* update comment format ([09b59a1](https://github.com/forsigner/object-to-schema/commit/09b59a1))
<a name="1.4.0"></a>

@@ -7,0 +17,0 @@ # [1.4.0](https://github.com/forsigner/object-to-schema/compare/v1.3.2...v1.4.0) (2017-12-29)

4

example/index.js

@@ -6,3 +6,3 @@ 'use strict';

const obj = {
'// name': [ null, [ '// user name|maxLength:10' ]],
'// name': 'user name|maxLength:10',
name: 'Tom',

@@ -12,3 +12,3 @@ times: [ 1, 2, 3 ],

user: {
'// age': [ null, [ '// 年龄' ]],
'// age': '年龄',
age: 1,

@@ -15,0 +15,0 @@ '// addr': '地址',

@@ -74,3 +74,3 @@ 'use strict';

var type = typeOf(object[item]);
var desc = getDesc(object['// ' + item]);
var desc = object['// ' + item];
var value = '' + object[item] + separator + type + separator + desc;

@@ -101,10 +101,2 @@ obj[item] = makeSchema(value);

function getDesc() {
var comment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
if (!_.isArray(comment) || _.isEmpty(comment)) return '';
return (comment[1] || '').toString().replace(/^\/\//, '').trim();
}
function objectToSchema(data) {

@@ -111,0 +103,0 @@ var _iteratorNormalCompletion2 = true;

{
"name": "object-to-schema",
"description": "",
"version": "1.4.0",
"version": "1.5.0",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "author": {

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