New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@lpgroup/yup

Package Overview
Dependencies
Maintainers
2
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lpgroup/yup

Collection of yup validation functions.

latest
Source
npmnpm
Version
1.10.2
Version published
Weekly downloads
98
4800%
Maintainers
2
Weekly downloads
 
Created
Source

@lpgroup/yup

npm version Known VulnerabilitiesLicence MIT tested with jest codecov

Collection of yup validation and helper functions for projects based on feathersjs.

Install

Installation of the npm

npm install @lpgroup/yup

Example

const yup = require("@lpgroup/yup");

const schema = { key: yup.string().required() };

Hooks

/* xxx.yup.js */
const cy = require("@lpgroup/yup");

const requestSchema = {
  _id: cy.uuid().required(),
  alias: cy.string().required(),
  name: cy.string().required(),
  createdAt: cy.timestamp().defaultNull(),
  changedAt: cy.timestamp().defaultNull(),
};

const dbSchema = {
  added: cy.changed(),
  changed: cy.changed(),
  owner: cy.owner(),
};

module.exports = cy.buildValidationSchema(requestSchema, dbSchema);
module.exports.requestSchema = requestSchema;
/* xxx.service.js */
const { Xxx } = require("./xxx.class");
const hooks = require("./xxx.hooks");
const schema = require("./xxx.yup");

module.exports = (app) => {
  const options = { id: "alias", schema };
  app.use("/xxx", new Xxx(options, app));
  const service = app.service("xxx");
  service.hooks(hooks);
};
/* xxx.hooks.js */
const { validReq } = require("@lpgroup/yup");
const { validDB } = require("@lpgroup/yup");

module.exports = {
  before: {
    create: [validReq(), changeData(), validDB()],
    update: [validReq(), changeData(), validDB()],
    patch: [validReq(), changeData(), validDB()],
  },
};

API

general

hooks

validReq(objSchema)

validReq(xxx);

validDB(objSchema)

validDB(xxx);

yup.array(objSchema)

const schema = { key: yup.array({ key: yup.string() }).required() };

Development

When developing this NPM your can patch yup to give better error message.

npm run patch-package

Contribute

See contribute

License

MIT - See licence

Keywords

lpgroup

FAQs

Package last updated on 09 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts