Socket
Socket
Sign inDemoInstall

yn

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

lenient.js

9

index.js
'use strict';
module.exports = function (val) {
var lenient = require('./lenient');
module.exports = function (val, opts) {
val = String(val).trim();
opts = opts || {};

@@ -13,3 +16,7 @@ if (/^(?:y|yes|true)$/i.test(val)) {

if (opts.lenient === true) {
return lenient(val);
}
return null;
};

10

package.json
{
"name": "yn",
"version": "1.0.0",
"version": "1.1.0",
"description": "Parse yes/no like values",

@@ -19,3 +19,4 @@ "license": "MIT",

"files": [
"index.js"
"index.js",
"lenient.js"
],

@@ -33,7 +34,8 @@ "keywords": [

"false",
"parse"
"parse",
"lenient"
],
"devDependencies": {
"ava": "0.0.3"
"ava": "0.0.4"
}
}

@@ -15,3 +15,5 @@ # yn [![Build Status](https://travis-ci.org/sindresorhus/yn.svg?branch=master)](https://travis-ci.org/sindresorhus/yn)

*Enable lenient mode to gracefully handle typos.*
## Install

@@ -38,7 +40,12 @@

yn('unicorn');
yn('abomasum');
//=> null
// lenient mode will use a key distance-based score
// to leniently accept typos of "yes" and "no"
yn('mo', {lenient: true});
//=> false
```
Unrecognized values returns `null`.
Unrecognized values return `null`.

@@ -45,0 +52,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc