Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove browser code #13

Merged
merged 6 commits into from
Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# Coverage directory used by tools like istanbul
coverage

# Browerify output directories
web
test/web
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
coverage/
.nyc_output/
CHANGELOG.md
web/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016-2021 Takayuki Sato <[email protected]>, Blaine Bublitz <[email protected]>, and Eric Schoffstall <[email protected]>
Copyright (c) 2016-2022 Takayuki Sato <[email protected]>, Blaine Bublitz <[email protected]>, and Eric Schoffstall <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
39 changes: 17 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,13 @@ To install from npm:
$ npm i copy-props --save
```

## Load this module

For Node.js:

```js
const copyProps = require('copy-props');
```

For Web browser:

```html
<script src="copy-props.min.js"></script>
```

## Usage

Copy _src_ to _dst_ simply (and return _dst_) :

```js
const copyProps = require('copy-props');

var src = { a: 1, b: { b1: 'bbb' }, c: 'ccc' };
var dst = { a: 2, b: { b1: 'xxx', b2: 'yyy' } };

Expand All @@ -47,6 +35,8 @@ copyProps(src, dst);
Copy _src_ to _dst_ with property mapping (and return _dst_) :

```js
const copyProps = require('copy-props');

var src = { a: 1, b: { b1: 'bbb' }, c: 'ccc', d: 'ddd' };
var dst = { f: { a: 2, b1: 'xxx', b2: 'yyy' }, e: 'zzz' };

Expand All @@ -62,6 +52,8 @@ copyProps(src, dst, {
Copy _src_ to _dst_ with convert function (and return _dst_) :

```js
const copyProps = require('copy-props');

var src = { a: 1, b: { b1: 'bbb' } };
var dst = { a: 0 };

Expand All @@ -79,6 +71,8 @@ copyProps(src, dst, function (srcInfo) {
Can use an array instead of a map as property mapping :

```js
const copyProps = require('copy-props');

var src = { a: 1, b: { c: 'CCC' }, d: { e: 'EEE' } };
var dst = { a: 9, b: { c: 'xxx' }, d: { e: 'yyy' } };
var fromto = ['b.c', 'd.e'];
Expand All @@ -89,6 +83,8 @@ copyProps(src, dst, fromto);
Can copy reversively (from _dst_ to _src_) by reverse flag (and return _src_):

```js
const copyProps = require('copy-props');

var src = { a: 1, b: { b1: 'bbb' }, c: 'ccc' };
var dst = { a: 2, b: { b1: 'xxx', b2: 'yyy' } };

Expand All @@ -97,6 +93,8 @@ copyProps(src, dst, true);
```

```js
const copyProps = require('copy-props');

var src = { a: 1, b: { b1: 'bbb' }, c: 'ccc', d: 'ddd' };
var dst = { f: { a: 2, b1: 'xxx', b2: 'yyy' }, e: 'zzz' };

Expand All @@ -116,6 +114,8 @@ copyProps(
If a value of source property is undefined (when not using converter), or a result of converter is undefined (when using converter), the value is not copied.

```js
const copyProps = require('copy-props');

var src = { a: 'A', b: undefined, c: null, d: 1 };
var dst = { a: 'a', b: 'b', c: 'c' };

Expand All @@ -132,6 +132,8 @@ copyProps(src, dst, function (srcInfo) {
You can operate the parent node object directly in converter.

```js
const copyProps = require('copy-props');

var src = { a: 1, b: 2 };
var dst = {};

Expand Down Expand Up @@ -221,10 +223,7 @@ _dst_ object after copying.

## License

Copyright (C) 2016-2021 Gulp Team.

This program is free software under [MIT][mit-url] License.
See the file LICENSE in this distribution for more details.
MIT

<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/copy-props.svg?style=flat-square
Expand All @@ -237,7 +236,3 @@ See the file LICENSE in this distribution for more details.
[coveralls-url]: https://coveralls.io/r/gulpjs/copy-props
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/copy-props/master.svg
<!-- prettier-ignore-end -->

<!-- prettier-ignore-start -->
[mit-url]: https://opensource.org/licenses/MIT
<!-- prettier-ignore-end -->
26 changes: 7 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,15 @@
"author": "Gulp Team <[email protected]> (https://gulpjs.com/)",
"main": "index.js",
"files": [
"index.js"
"index.js",
"LICENSE"
],
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "nyc mocha",
"web:build": "browserify index.js --standalone copyProps -o web/copy-props.js && cd web && uglifyjs copy-props.js --compress --mangle -o copy-props.min.js --source-map url=copy-props.min.js.map",
"chrome:install": "npm i --no-save mocha-chrome",
"chrome:test": "mocha-chrome test/web/browser-test.html",
"build": "npm run lint && npm run test && npm run web:build && node test/web/make.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gulpjs/copy-props.git"
"test": "nyc mocha --async-only"
},
"repository": "gulpjs/copy-prop",
"keywords": [
"object",
"property",
Expand All @@ -32,10 +26,6 @@
"engines": {
"node": ">= 10.13.0"
},
"bugs": {
"url": "https://github.com/gulpjs/copy-props/issues"
},
"homepage": "https://github.com/gulpjs/copy-props#readme",
"nyc": {
"reporter": [
"lcov",
Expand All @@ -46,17 +36,15 @@
"singleQuote": true
},
"dependencies": {
"each-props": "^2.0.0",
"each-props": "^3.0.0",
"is-plain-object": "^5.0.0"
},
"devDependencies": {
"browserify": "^17.0.0",
"chai": "^4.3.4",
"eslint": "^7.32.0",
"eslint-config-gulp": "^5.0.1",
"eslint-plugin-node": "^11.1.0",
"expect": "^27.5.1",
"mocha": "^8.4.0",
"nyc": "^15.1.0",
"uglify-js": "^3.14.2"
"nyc": "^15.1.0"
}
}
Loading