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

@produck/mold

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@produck/mold - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

8

package.json
{
"name": "@produck/mold",
"version": "0.1.0",
"version": "0.1.1",
"description": "For helping to create a final options from a defined specification.",

@@ -45,7 +45,7 @@ "keywords": [

"c8": "^7.12.0",
"eslint": "^8.23.1",
"eslint": "^8.24.0",
"mocha": "^10.0.0",
"rollup": "^2.79.0"
"rollup": "^2.79.1"
},
"gitHead": "5b6b545116b9a36107fa70de676bb13de6b3af5d"
"gitHead": "b84c1ada27a2db03beb181d38c38eb38d9c7a1e0"
}

@@ -9,4 +9,8 @@ # @produck/mold

A tool module for defining data type schemas to a normalize function. It has been published as a "Dual CommonJS/ES module [[1]](https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#dual-commonjses-module-packages)" package. It is very simple, flexible. There is also some default "Catcher" for helping to throw a "TypeError" with good readability messages. It can work in "node.js" and browsers.
A tool module for defining data type schemas to a normalize function. It has been published as a "[Dual CommonJS/ES module](https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#dual-commonjses-module-packages)" package but ESM first. It is very simple, flexible and extensible.
There is also some default "Catcher" for helping to throw a "[TypeError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError)" with good readability messages. It can be also defined a completely custom catcher to handle the cause if a bad value provided.
It can work in "node.js" and browsers. It is also very friendly with "tree shaking", using "[Rollup](https://rollupjs.org/guide/en/)" so try ESM firstly.
## Installation

@@ -44,4 +48,35 @@ ```

### Import & Require
As esModule,
```js
import {
Simplex, Simp, S,
Compound, Comp, C,
Preset, Pre, P,
Normalizer, Circular, Custom,
Catcher
} from '@produck/mold';
```
As CommonJS,
```js
const {
Simplex, Simp, S,
Compound, Comp, C,
Preset, Pre, P,
Normalizer, Circular, Custom,
Catcher
} = require('@produck/mold');
```
### Creating a normalize() from schema
```js
import { S, P, Normalizer } from '@produck/mold';
const OptionsSchema = S.Object({
foo: P.String('bar')
});
const normalize = Normalizer(OptionsSchema);
const finalOptions = normalize();
```
### Custom Simplex Value Schema

@@ -48,0 +83,0 @@ ```js

import { Schema } from './schema';
export const Constant: <Type>(value: Type) => Schema<Type>;
export const Enum: (valueList: Array<any>) => Schema;
export const Constant: <Type>(
value: Type,
required?: boolean
) => Schema<Type>;
export const Null: Schema<null>;
export const Enum: <Type>(
valueList: Array<Type>,
defaultIndex?: number | null
) => Schema<Type>;
export const Null: (required?: boolean) => Schema<null>;
export const NotNull: Schema<Exclude<any, null>>;

@@ -8,0 +15,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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