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

@xolvio/fiber-utils

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xolvio/fiber-utils - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

19

__tests__/index-spec.js

@@ -237,2 +237,21 @@ describe('fiber-utils', function () {

describe('when the object already has a function with the same name', function () {
it('uses an unused name', function () {
var myFunc = myObject.myFunc;
var existingFunc = function () {};
myObject.myFuncAsync = existingFunc;
myObject.myFuncSync = existingFunc;
fiberUtils.wrapAsyncObject(myObject, ['myFunc'], {
wrapAsync: wrapAsync
});
expect(myObject.myFuncAsync).toBe(existingFunc);
expect(myObject.myFuncSync).toBe(existingFunc);
expect(myObject.myFuncAsync2).toBe(myFunc);
expect(myObject.myFuncSync2).toBeDefined();
expect(myObject.myFuncSync2.isWrapped).toBe(true);
});
});
describe('options', function () {

@@ -239,0 +258,0 @@ it('"syncByDefault: false" makes the default function async', function () {

15

index.js

@@ -62,4 +62,15 @@ var Fiber = require('fibers');

var syncMethod = wrapAsync(asyncMethod, object);
object[propertyName + 'Async'] = asyncMethod;
object[propertyName + 'Sync'] = syncMethod;
var asyncMethodName = propertyName + 'Async';
if (object[asyncMethodName]) {
asyncMethodName += '2';
}
object[asyncMethodName] = asyncMethod;
var syncMethodName = propertyName + 'Sync';
if (object[syncMethodName]) {
syncMethodName += '2';
}
object[syncMethodName] = syncMethod;
if (syncByDefault) {

@@ -66,0 +77,0 @@ object[propertyName] = syncMethod;

10

package.json
{
"name": "@xolvio/fiber-utils",
"version": "1.0.0",
"version": "1.0.1",
"description": "Fiber utilities to convert async functions to sync ones",

@@ -24,7 +24,11 @@ "keywords": [

"jest": {
"moduleFileExtensions": ["js", "json", "node"]
"moduleFileExtensions": [
"js",
"json",
"node"
]
},
"dependencies": {
"fibers": "^1.0.6",
"underscore": "~1.8.3"
"underscore": "^1.8.3"
},

@@ -31,0 +35,0 @@ "devDependencies": {

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