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

keep-func-props

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keep-func-props - npm Package Compare versions

Comparing version 3.0.1 to 4.0.0

10

build/src/main.js

@@ -1,2 +0,2 @@

"use strict";var _mimicFn=_interopRequireDefault(require("mimic-fn"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
import mimicFn from"mimic-fn";

@@ -14,3 +14,3 @@

if(typeof func==="function"&&typeof newFunc==="function"){
(0,_mimicFn.default)(newFunc,func,{ignoreNonConfigurable:true});
mimicFn(newFunc,func,{ignoreNonConfigurable:true});
}

@@ -27,7 +27,3 @@

const keepFuncPropsB=keepFuncPropsA(keepFuncProps);
module.exports=keepFuncPropsB;
export default keepFuncPropsA(keepFuncProps);
//# sourceMappingURL=main.js.map

@@ -8,9 +8,4 @@ // Demo of the main usage.

'use strict'
import keepFuncProps from 'keep-func-props'
// Ignore the following line: this is only needed for internal purposes.
require('./utils.js')
const keepFuncProps = require('keep-func-props')
// Any function wrapper works

@@ -28,12 +23,10 @@ const wrapper = function (anyFunction) {

console.log(getTrue) // `[Function: getTrue]`
console.log(wrapper(getTrue)) // `[Function]`
console.log(wrapper(getTrue)) // `[Function (anonymous)]`
console.log(betterWrapper(getTrue)) // `[Function: getTrue]`
// Function body is kept when stringified
console.log(String(getTrue))
// () => true
console.log(String(wrapper(getTrue)))
// (...args) => anyFunction(...args)
console.log(String(getTrue)) // () => true
console.log(String(wrapper(getTrue))) // (...args) => anyFunction(...args)
console.log(String(betterWrapper(getTrue)))
// /* Wrapped */
// () => true
{
"name": "keep-func-props",
"version": "3.0.1",
"main": "build/src/main.js",
"version": "4.0.0",
"type": "module",
"exports": "./build/src/main.js",
"files": [
"build/src",
"examples",
"!*~"
"build/src/**/*.{js,ts,map,json,sh,md}",
"examples/**/*.{js,ts,map,json,sh,md}"
],

@@ -13,7 +13,2 @@ "scripts": {

},
"husky": {
"hooks": {
"pre-push": "gulp -LL check --full"
}
},
"description": "Wrap a function without changing its name and other properties",

@@ -43,14 +38,11 @@ "keywords": [

"dependencies": {
"mimic-fn": "^3.1.0"
"mimic-fn": "^4.0.0"
},
"devDependencies": {
"@ehmicky/dev-tasks": "^0.31.52",
"ava": "^3.10.1",
"gulp": "^4.0.2",
"husky": "^4.2.5",
"sinon": "^9.0.2"
"@ehmicky/dev-tasks": "^1.0.33",
"sinon": "^11.1.1"
},
"engines": {
"node": ">=10.17.0"
"node": ">=12.20.0"
}
}

@@ -1,2 +0,2 @@

<img src="https://raw.githubusercontent.com/ehmicky/design/master/keep-func-props/keep-func-props.svg?sanitize=true" width="700"/>
<img src="https://raw.githubusercontent.com/ehmicky/design/main/keep-func-props/keep-func-props.svg?sanitize=true" width="700"/>

@@ -6,3 +6,2 @@ [![Codecov](https://img.shields.io/codecov/c/github/ehmicky/keep-func-props.svg?label=tested&logo=codecov)](https://codecov.io/gh/ehmicky/keep-func-props)

[![Node](https://img.shields.io/node/v/keep-func-props.svg?logo=node.js)](https://www.npmjs.com/package/keep-func-props)
[![Gitter](https://img.shields.io/gitter/room/ehmicky/keep-func-props.svg?logo=gitter)](https://gitter.im/ehmicky/keep-func-props)
[![Twitter](https://img.shields.io/badge/%E2%80%8B-twitter-4cc61e.svg?logo=twitter)](https://twitter.com/intent/follow?screen_name=ehmicky)

@@ -26,6 +25,8 @@ [![Medium](https://img.shields.io/badge/%E2%80%8B-medium-4cc61e.svg?logo=medium)](https://medium.com/@ehmicky)

<!-- eslint-disable node/file-extension-in-import -->
```js
const keepFuncProps = require('keep-func-props')
import keepFuncProps from 'keep-func-props'
// Any function wrapper works
const memoize = require('lodash/memoize')
import memoize from 'lodash/memoize'

@@ -69,6 +70,10 @@ const betterMemoize = keepFuncProps(memoize)

This package is an ES module and must be loaded using
[an `import` or `import()` statement](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c),
not `require()`.
# Usage
```js
const keepFuncProps = require('keep-func-props')
import keepFuncProps from 'keep-func-props'

@@ -98,8 +103,4 @@ // Any function wrapper works

If you found a bug or would like a new feature, _don't hesitate_ to
[submit an issue on GitHub](../../issues).
For any question, _don't hesitate_ to [submit an issue on GitHub](../../issues).
For other questions, feel free to
[chat with us on Gitter](https://gitter.im/ehmicky/keep-func-props).
Everyone is welcome regardless of personal background. We enforce a

@@ -106,0 +107,0 @@ [Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and

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