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

fakerest

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fakerest - npm Package Compare versions

Comparing version 2.2.0 to 3.0.0

dist/FakeRest.js.map

65

package.json
{
"name": "fakerest",
"version": "2.2.0",
"repository": "https://github.com/marmelab/FakeRest",
"description":
"Patch XMLHttpRequest to fake a REST server based on JSON data. ",
"scripts": {
"test": "make test"
},
"main": "dist/FakeRest.min.js",
"author": "François Zaninotto <fzaninotto@gmail.com>",
"license": "MIT",
"devDependencies": {
"array.prototype.findindex": "~2.0.0",
"babel-core": "~6.22.1",
"babel-loader": "~6.2.10",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-polyfill": "^6.22.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-stage-0": "^6.22.0",
"babel-runtime": "~6.22.0",
"fetch-mock": "~5.9.3",
"jasmine-core": "^2.5.2",
"karma": "1.4.1",
"karma-chrome-launcher": "2.0.0",
"karma-jasmine": "1.1.0",
"karma-phantomjs-launcher": "1.0.2",
"karma-spec-reporter": "0.0.26",
"object.assign": "~4.0.1",
"sinon": "~1.14.1",
"string.prototype.endswith": "~0.2.0",
"webpack": "~1.7.1"
},
"dependencies": {
"babel-runtime": "^6.22.0"
}
"name": "fakerest",
"version": "3.0.0",
"repository": "https://github.com/marmelab/FakeRest",
"description": "Patch XMLHttpRequest to fake a REST server based on JSON data. ",
"scripts": {
"test": "jest"
},
"main": "dist/FakeRest.min.js",
"author": "François Zaninotto <fzaninotto@gmail.com>",
"license": "MIT",
"devDependencies": {
"@babel/preset-env": "^7.12.13",
"babel-core": "^6.26.3",
"babel-loader": "^8.2.2",
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-runtime": "^6.26.0",
"fetch-mock": "^9.11.0",
"jest": "^26.6.3",
"sinon": "~1.14.1",
"terser-webpack-plugin": "^5.1.1",
"webpack": "^5.20.0",
"webpack-cli": "^4.5.0"
},
"dependencies": {
"babel-runtime": "^6.26.0"
},
"browserslist": "> 0.25%, not dead"
}

@@ -1,5 +0,1 @@

import objectAssign from 'object.assign';
import 'array.prototype.findindex';
import 'string.prototype.endswith';
const every = (array, predicate) =>

@@ -121,3 +117,3 @@ array.reduce((acc, value) => acc && predicate(value), true);

export default class Collection {
export class Collection {

@@ -230,3 +226,3 @@ constructor(items=[], identifierName='id') {

}
items = items.map(item => objectAssign({}, item)) // clone item to avoid returning the original
items = items.map(item => Object.assign({}, item)) // clone item to avoid returning the original
if (query.embed && this.server) {

@@ -249,3 +245,3 @@ items = items.map(this._itemEmbedder(query.embed)); // embed reference

let item = this.items[index];
item = objectAssign({}, item); // clone item to avoid returning the original
item = Object.assign({}, item); // clone item to avoid returning the original
if (query && query.embed && this.server) {

@@ -269,3 +265,3 @@ item = this._itemEmbedder(query.embed)(item); // embed reference

this.items.push(item);
return objectAssign({}, item); // clone item to avoid returning the original;
return Object.assign({}, item); // clone item to avoid returning the original;
}

@@ -281,3 +277,3 @@

}
return objectAssign({}, this.items[index]); // clone item to avoid returning the original
return Object.assign({}, this.items[index]); // clone item to avoid returning the original
}

@@ -284,0 +280,0 @@

@@ -1,11 +0,7 @@

import Server from 'Server';
import FetchServer from 'FetchServer';
import Collection from 'Collection';
import Single from 'Single';
import { Server } from './Server';
import { FetchServer } from './FetchServer';
import { Collection } from './Collection';
import { Single } from './Single';
export default {
Server: Server,
FetchServer: FetchServer,
Collection: Collection,
Single: Single
}
export { Server, FetchServer, Collection, Single };
export default { Server, FetchServer, Collection, Single };

@@ -1,10 +0,5 @@

import objectAssign from 'object.assign';
import Server from 'Server';
import Collection from 'Collection';
import Single from 'Single';
import parseQueryString from 'parseQueryString';
import { Server } from './Server';
import { parseQueryString } from './parseQueryString';
const assign = objectAssign.getPolyfill();
export default class FetchServer extends Server {
export class FetchServer extends Server {
decode(request, opts) {

@@ -114,3 +109,3 @@ const req = (typeof request === 'string') ? new Request(request, opts) : request;

if (!matches) continue;
let params = assign({}, this.defaultQuery(name), request.params);
let params = Object.assign({}, this.defaultQuery(name), request.params);
if (!matches[2]) {

@@ -117,0 +112,0 @@ if (request.method == 'GET') {

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

export default function parseQueryString(queryString) {
export function parseQueryString(queryString) {
if (!queryString) {

@@ -3,0 +3,0 @@ return {};

@@ -1,9 +0,6 @@

import objectAssign from 'object.assign';
import Collection from 'Collection';
import Single from 'Single';
import parseQueryString from 'parseQueryString';
import { Collection } from './Collection';
import { Single } from './Single';
import { parseQueryString } from './parseQueryString';
const assign = objectAssign.getPolyfill();
export default class Server {
export class Server {
constructor(baseUrl='') {

@@ -282,3 +279,3 @@ this.baseUrl = baseUrl;

let name = matches[1];
let params = assign({}, this.defaultQuery(name), request.params);
let params = Object.assign({}, this.defaultQuery(name), request.params);
if (!matches[2]) {

@@ -285,0 +282,0 @@ if (request.method == 'GET') {

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

import objectAssign from 'object.assign';
import 'string.prototype.endswith';
export default class Single {
export class Single {
constructor(obj) {

@@ -68,3 +65,3 @@ if (!(obj instanceof Object)) {

if (query && query.embed && this.server) {
item = objectAssign({}, item); // Clone
item = Object.assign({}, item); // Clone
item = this._itemEmbedder(query.embed)(item);

@@ -71,0 +68,0 @@ }

@@ -0,20 +1,32 @@

const path = require('path');
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
mode: 'development',
entry: {
FakeRest: './src/FakeRest.js'
FakeRest: './src/FakeRest.js',
"FakeRest.min": './src/FakeRest.js'
},
devtool: "source-map",
resolve:{
modulesDirectories: [
modules: [
'node_modules',
'src'
path.join(__dirname, "src")
]
},
module: {
loaders: [{
rules: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
loader: 'babel-loader'
}]
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
include: /\.min\.js$/
})]
},
output: {
path: './dist',
path: path.resolve(__dirname, './dist'),
filename: '[name].js',

@@ -21,0 +33,0 @@ library: 'FakeRest',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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