update
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,39 @@
|
||||
var concatMap = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('empty or not', function (t) {
|
||||
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||
var ixes = [];
|
||||
var ys = concatMap(xs, function (x, ix) {
|
||||
ixes.push(ix);
|
||||
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||
});
|
||||
t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]);
|
||||
t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('always something', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ];
|
||||
});
|
||||
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('scalars', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x === 'b' ? [ 'B', 'B', 'B' ] : x;
|
||||
});
|
||||
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('undefs', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function () {});
|
||||
t.same(ys, [ undefined, undefined, undefined, undefined ]);
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,254 @@
|
||||
A. HISTORY OF THE SOFTWARE
|
||||
==========================
|
||||
|
||||
Python was created in the early 1990s by Guido van Rossum at Stichting
|
||||
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
|
||||
as a successor of a language called ABC. Guido remains Python's
|
||||
principal author, although it includes many contributions from others.
|
||||
|
||||
In 1995, Guido continued his work on Python at the Corporation for
|
||||
National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
|
||||
in Reston, Virginia where he released several versions of the
|
||||
software.
|
||||
|
||||
In May 2000, Guido and the Python core development team moved to
|
||||
BeOpen.com to form the BeOpen PythonLabs team. In October of the same
|
||||
year, the PythonLabs team moved to Digital Creations, which became
|
||||
Zope Corporation. In 2001, the Python Software Foundation (PSF, see
|
||||
https://www.python.org/psf/) was formed, a non-profit organization
|
||||
created specifically to own Python-related Intellectual Property.
|
||||
Zope Corporation was a sponsoring member of the PSF.
|
||||
|
||||
All Python releases are Open Source (see http://www.opensource.org for
|
||||
the Open Source Definition). Historically, most, but not all, Python
|
||||
releases have also been GPL-compatible; the table below summarizes
|
||||
the various releases.
|
||||
|
||||
Release Derived Year Owner GPL-
|
||||
from compatible? (1)
|
||||
|
||||
0.9.0 thru 1.2 1991-1995 CWI yes
|
||||
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
|
||||
1.6 1.5.2 2000 CNRI no
|
||||
2.0 1.6 2000 BeOpen.com no
|
||||
1.6.1 1.6 2001 CNRI yes (2)
|
||||
2.1 2.0+1.6.1 2001 PSF no
|
||||
2.0.1 2.0+1.6.1 2001 PSF yes
|
||||
2.1.1 2.1+2.0.1 2001 PSF yes
|
||||
2.1.2 2.1.1 2002 PSF yes
|
||||
2.1.3 2.1.2 2002 PSF yes
|
||||
2.2 and above 2.1.1 2001-now PSF yes
|
||||
|
||||
Footnotes:
|
||||
|
||||
(1) GPL-compatible doesn't mean that we're distributing Python under
|
||||
the GPL. All Python licenses, unlike the GPL, let you distribute
|
||||
a modified version without making your changes open source. The
|
||||
GPL-compatible licenses make it possible to combine Python with
|
||||
other software that is released under the GPL; the others don't.
|
||||
|
||||
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
|
||||
because its license has a choice of law clause. According to
|
||||
CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
|
||||
is "not incompatible" with the GPL.
|
||||
|
||||
Thanks to the many outside volunteers who have worked under Guido's
|
||||
direction to make these releases possible.
|
||||
|
||||
|
||||
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
|
||||
===============================================================
|
||||
|
||||
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
||||
--------------------------------------------
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Python Software Foundation
|
||||
("PSF"), and the Individual or Organization ("Licensee") accessing and
|
||||
otherwise using this software ("Python") in source or binary form and
|
||||
its associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, PSF hereby
|
||||
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
|
||||
analyze, test, perform and/or display publicly, prepare derivative works,
|
||||
distribute, and otherwise use Python alone or in any derivative version,
|
||||
provided, however, that PSF's License Agreement and PSF's notice of copyright,
|
||||
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
|
||||
All Rights Reserved" are retained in Python alone or in any derivative version
|
||||
prepared by Licensee.
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python.
|
||||
|
||||
4. PSF is making Python available to Licensee on an "AS IS"
|
||||
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. Nothing in this License Agreement shall be deemed to create any
|
||||
relationship of agency, partnership, or joint venture between PSF and
|
||||
Licensee. This License Agreement does not grant permission to use PSF
|
||||
trademarks or trade name in a trademark sense to endorse or promote
|
||||
products or services of Licensee, or any third party.
|
||||
|
||||
8. By copying, installing or otherwise using Python, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
|
||||
|
||||
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
|
||||
-------------------------------------------
|
||||
|
||||
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
|
||||
|
||||
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
|
||||
office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
|
||||
Individual or Organization ("Licensee") accessing and otherwise using
|
||||
this software in source or binary form and its associated
|
||||
documentation ("the Software").
|
||||
|
||||
2. Subject to the terms and conditions of this BeOpen Python License
|
||||
Agreement, BeOpen hereby grants Licensee a non-exclusive,
|
||||
royalty-free, world-wide license to reproduce, analyze, test, perform
|
||||
and/or display publicly, prepare derivative works, distribute, and
|
||||
otherwise use the Software alone or in any derivative version,
|
||||
provided, however, that the BeOpen Python License is retained in the
|
||||
Software, alone or in any derivative version prepared by Licensee.
|
||||
|
||||
3. BeOpen is making the Software available to Licensee on an "AS IS"
|
||||
basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
|
||||
SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
|
||||
AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
|
||||
DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
5. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
6. This License Agreement shall be governed by and interpreted in all
|
||||
respects by the law of the State of California, excluding conflict of
|
||||
law provisions. Nothing in this License Agreement shall be deemed to
|
||||
create any relationship of agency, partnership, or joint venture
|
||||
between BeOpen and Licensee. This License Agreement does not grant
|
||||
permission to use BeOpen trademarks or trade names in a trademark
|
||||
sense to endorse or promote products or services of Licensee, or any
|
||||
third party. As an exception, the "BeOpen Python" logos available at
|
||||
http://www.pythonlabs.com/logos.html may be used according to the
|
||||
permissions granted on that web page.
|
||||
|
||||
7. By copying, installing or otherwise using the software, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
|
||||
|
||||
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
|
||||
---------------------------------------
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Corporation for National
|
||||
Research Initiatives, having an office at 1895 Preston White Drive,
|
||||
Reston, VA 20191 ("CNRI"), and the Individual or Organization
|
||||
("Licensee") accessing and otherwise using Python 1.6.1 software in
|
||||
source or binary form and its associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, CNRI
|
||||
hereby grants Licensee a nonexclusive, royalty-free, world-wide
|
||||
license to reproduce, analyze, test, perform and/or display publicly,
|
||||
prepare derivative works, distribute, and otherwise use Python 1.6.1
|
||||
alone or in any derivative version, provided, however, that CNRI's
|
||||
License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
|
||||
1995-2001 Corporation for National Research Initiatives; All Rights
|
||||
Reserved" are retained in Python 1.6.1 alone or in any derivative
|
||||
version prepared by Licensee. Alternately, in lieu of CNRI's License
|
||||
Agreement, Licensee may substitute the following text (omitting the
|
||||
quotes): "Python 1.6.1 is made available subject to the terms and
|
||||
conditions in CNRI's License Agreement. This Agreement together with
|
||||
Python 1.6.1 may be located on the Internet using the following
|
||||
unique, persistent identifier (known as a handle): 1895.22/1013. This
|
||||
Agreement may also be obtained from a proxy server on the Internet
|
||||
using the following URL: http://hdl.handle.net/1895.22/1013".
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python 1.6.1 or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python 1.6.1.
|
||||
|
||||
4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
|
||||
basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. This License Agreement shall be governed by the federal
|
||||
intellectual property law of the United States, including without
|
||||
limitation the federal copyright law, and, to the extent such
|
||||
U.S. federal law does not apply, by the law of the Commonwealth of
|
||||
Virginia, excluding Virginia's conflict of law provisions.
|
||||
Notwithstanding the foregoing, with regard to derivative works based
|
||||
on Python 1.6.1 that incorporate non-separable material that was
|
||||
previously distributed under the GNU General Public License (GPL), the
|
||||
law of the Commonwealth of Virginia shall govern this License
|
||||
Agreement only as to issues arising under or with respect to
|
||||
Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
|
||||
License Agreement shall be deemed to create any relationship of
|
||||
agency, partnership, or joint venture between CNRI and Licensee. This
|
||||
License Agreement does not grant permission to use CNRI trademarks or
|
||||
trade name in a trademark sense to endorse or promote products or
|
||||
services of Licensee, or any third party.
|
||||
|
||||
8. By clicking on the "ACCEPT" button where indicated, or by copying,
|
||||
installing or otherwise using Python 1.6.1, Licensee agrees to be
|
||||
bound by the terms and conditions of this License Agreement.
|
||||
|
||||
ACCEPT
|
||||
|
||||
|
||||
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
|
||||
--------------------------------------------------
|
||||
|
||||
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
|
||||
The Netherlands. All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Stichting Mathematisch
|
||||
Centrum or CWI not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
|
||||
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -0,0 +1,319 @@
|
||||
NOTE: The default branch has been renamed!
|
||||
master is now named main
|
||||
|
||||
If you have a local clone, you can update it by running:
|
||||
|
||||
```shell
|
||||
git branch -m master main
|
||||
git fetch origin
|
||||
git branch -u origin/main main
|
||||
```
|
||||
|
||||
# **node-addon-api module**
|
||||
This module contains **header-only C++ wrapper classes** which simplify
|
||||
the use of the C based [Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)
|
||||
provided by Node.js when using C++. It provides a C++ object model
|
||||
and exception handling semantics with low overhead.
|
||||
|
||||
There are three options for implementing addons: Node-API, nan, or direct
|
||||
use of internal V8, libuv, and Node.js libraries. Unless there is a need for
|
||||
direct access to functionality that is not exposed by Node-API as outlined
|
||||
in [C/C++ addons](https://nodejs.org/dist/latest/docs/api/addons.html)
|
||||
in Node.js core, use Node-API. Refer to
|
||||
[C/C++ addons with Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)
|
||||
for more information on Node-API.
|
||||
|
||||
Node-API is an ABI stable C interface provided by Node.js for building native
|
||||
addons. It is independent of the underlying JavaScript runtime (e.g. V8 or ChakraCore)
|
||||
and is maintained as part of Node.js itself. It is intended to insulate
|
||||
native addons from changes in the underlying JavaScript engine and allow
|
||||
modules compiled for one version to run on later versions of Node.js without
|
||||
recompilation.
|
||||
|
||||
The `node-addon-api` module, which is not part of Node.js, preserves the benefits
|
||||
of the Node-API as it consists only of inline code that depends only on the stable API
|
||||
provided by Node-API. As such, modules built against one version of Node.js
|
||||
using node-addon-api should run without having to be rebuilt with newer versions
|
||||
of Node.js.
|
||||
|
||||
It is important to remember that *other* Node.js interfaces such as
|
||||
`libuv` (included in a project via `#include <uv.h>`) are not ABI-stable across
|
||||
Node.js major versions. Thus, an addon must use Node-API and/or `node-addon-api`
|
||||
exclusively and build against a version of Node.js that includes an
|
||||
implementation of Node-API (meaning an active LTS version of Node.js) in
|
||||
order to benefit from ABI stability across Node.js major versions. Node.js
|
||||
provides an [ABI stability guide][] containing a detailed explanation of ABI
|
||||
stability in general, and the Node-API ABI stability guarantee in particular.
|
||||
|
||||
As new APIs are added to Node-API, node-addon-api must be updated to provide
|
||||
wrappers for those new APIs. For this reason, node-addon-api provides
|
||||
methods that allow callers to obtain the underlying Node-API handles so
|
||||
direct calls to Node-API and the use of the objects/methods provided by
|
||||
node-addon-api can be used together. For example, in order to be able
|
||||
to use an API for which the node-addon-api does not yet provide a wrapper.
|
||||
|
||||
APIs exposed by node-addon-api are generally used to create and
|
||||
manipulate JavaScript values. Concepts and operations generally map
|
||||
to ideas specified in the **ECMA262 Language Specification**.
|
||||
|
||||
The [Node-API Resource](https://nodejs.github.io/node-addon-examples/) offers an
|
||||
excellent orientation and tips for developers just getting started with Node-API
|
||||
and node-addon-api.
|
||||
|
||||
- **[Setup](#setup)**
|
||||
- **[API Documentation](#api)**
|
||||
- **[Examples](#examples)**
|
||||
- **[Tests](#tests)**
|
||||
- **[More resource and info about native Addons](#resources)**
|
||||
- **[Badges](#badges)**
|
||||
- **[Code of Conduct](CODE_OF_CONDUCT.md)**
|
||||
- **[Contributors](#contributors)**
|
||||
- **[License](#license)**
|
||||
|
||||
## **Current version: 7.1.1**
|
||||
|
||||
(See [CHANGELOG.md](CHANGELOG.md) for complete Changelog)
|
||||
|
||||
[](https://nodei.co/npm/node-addon-api/) [](https://nodei.co/npm/node-addon-api/)
|
||||
|
||||
<a name="setup"></a>
|
||||
|
||||
node-addon-api is based on [Node-API](https://nodejs.org/api/n-api.html) and supports using different Node-API versions.
|
||||
This allows addons built with it to run with Node.js versions which support the targeted Node-API version.
|
||||
**However** the node-addon-api support model is to support only the active LTS Node.js versions. This means that
|
||||
every year there will be a new major which drops support for the Node.js LTS version which has gone out of service.
|
||||
|
||||
The oldest Node.js version supported by the current version of node-addon-api is Node.js 16.x.
|
||||
|
||||
## Setup
|
||||
- [Installation and usage](doc/setup.md)
|
||||
- [node-gyp](doc/node-gyp.md)
|
||||
- [cmake-js](doc/cmake-js.md)
|
||||
- [Conversion tool](doc/conversion-tool.md)
|
||||
- [Checker tool](doc/checker-tool.md)
|
||||
- [Generator](doc/generator.md)
|
||||
- [Prebuild tools](doc/prebuild_tools.md)
|
||||
|
||||
<a name="api"></a>
|
||||
|
||||
### **API Documentation**
|
||||
|
||||
The following is the documentation for node-addon-api.
|
||||
|
||||
- [Full Class Hierarchy](doc/hierarchy.md)
|
||||
- [Addon Structure](doc/addon.md)
|
||||
- Data Types:
|
||||
- [Env](doc/env.md)
|
||||
- [CallbackInfo](doc/callbackinfo.md)
|
||||
- [Reference](doc/reference.md)
|
||||
- [Value](doc/value.md)
|
||||
- [Name](doc/name.md)
|
||||
- [Symbol](doc/symbol.md)
|
||||
- [String](doc/string.md)
|
||||
- [Number](doc/number.md)
|
||||
- [Date](doc/date.md)
|
||||
- [BigInt](doc/bigint.md)
|
||||
- [Boolean](doc/boolean.md)
|
||||
- [External](doc/external.md)
|
||||
- [Object](doc/object.md)
|
||||
- [Array](doc/array.md)
|
||||
- [ObjectReference](doc/object_reference.md)
|
||||
- [PropertyDescriptor](doc/property_descriptor.md)
|
||||
- [Function](doc/function.md)
|
||||
- [FunctionReference](doc/function_reference.md)
|
||||
- [ObjectWrap](doc/object_wrap.md)
|
||||
- [ClassPropertyDescriptor](doc/class_property_descriptor.md)
|
||||
- [Buffer](doc/buffer.md)
|
||||
- [ArrayBuffer](doc/array_buffer.md)
|
||||
- [TypedArray](doc/typed_array.md)
|
||||
- [TypedArrayOf](doc/typed_array_of.md)
|
||||
- [DataView](doc/dataview.md)
|
||||
- [Error Handling](doc/error_handling.md)
|
||||
- [Error](doc/error.md)
|
||||
- [TypeError](doc/type_error.md)
|
||||
- [RangeError](doc/range_error.md)
|
||||
- [SyntaxError](doc/syntax_error.md)
|
||||
- [Object Lifetime Management](doc/object_lifetime_management.md)
|
||||
- [HandleScope](doc/handle_scope.md)
|
||||
- [EscapableHandleScope](doc/escapable_handle_scope.md)
|
||||
- [Memory Management](doc/memory_management.md)
|
||||
- [Async Operations](doc/async_operations.md)
|
||||
- [AsyncWorker](doc/async_worker.md)
|
||||
- [AsyncContext](doc/async_context.md)
|
||||
- [AsyncWorker Variants](doc/async_worker_variants.md)
|
||||
- [Thread-safe Functions](doc/threadsafe.md)
|
||||
- [ThreadSafeFunction](doc/threadsafe_function.md)
|
||||
- [TypedThreadSafeFunction](doc/typed_threadsafe_function.md)
|
||||
- [Promises](doc/promises.md)
|
||||
- [Version management](doc/version_management.md)
|
||||
|
||||
<a name="examples"></a>
|
||||
|
||||
### **Examples**
|
||||
|
||||
Are you new to **node-addon-api**? Take a look at our **[examples](https://github.com/nodejs/node-addon-examples)**
|
||||
|
||||
- **[Hello World](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/1_hello_world)**
|
||||
- **[Pass arguments to a function](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/2_function_arguments/node-addon-api)**
|
||||
- **[Callbacks](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/3_callbacks/node-addon-api)**
|
||||
- **[Object factory](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/4_object_factory/node-addon-api)**
|
||||
- **[Function factory](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/5_function_factory/node-addon-api)**
|
||||
- **[Wrapping C++ Object](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/6_object_wrap/node-addon-api)**
|
||||
- **[Factory of wrapped object](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/7_factory_wrap/node-addon-api)**
|
||||
- **[Passing wrapped object around](https://github.com/nodejs/node-addon-examples/tree/main/src/2-js-to-native-conversion/8_passing_wrapped/node-addon-api)**
|
||||
|
||||
<a name="tests"></a>
|
||||
|
||||
### **Tests**
|
||||
|
||||
To run the **node-addon-api** tests do:
|
||||
|
||||
```
|
||||
npm install
|
||||
npm test
|
||||
```
|
||||
|
||||
To avoid testing the deprecated portions of the API run
|
||||
```
|
||||
npm install
|
||||
npm test --disable-deprecated
|
||||
```
|
||||
|
||||
To run the tests targeting a specific version of Node-API run
|
||||
```
|
||||
npm install
|
||||
export NAPI_VERSION=X
|
||||
npm test --NAPI_VERSION=X
|
||||
```
|
||||
|
||||
where X is the version of Node-API you want to target.
|
||||
|
||||
To run a specific unit test, filter conditions are available
|
||||
|
||||
**Example:**
|
||||
compile and run only tests on objectwrap.cc and objectwrap.js
|
||||
```
|
||||
npm run unit --filter=objectwrap
|
||||
```
|
||||
|
||||
Multiple unit tests cane be selected with wildcards
|
||||
|
||||
**Example:**
|
||||
compile and run all test files ending with "reference" -> function_reference.cc, object_reference.cc, reference.cc
|
||||
```
|
||||
npm run unit --filter=*reference
|
||||
```
|
||||
|
||||
Multiple filter conditions can be joined to broaden the test selection
|
||||
|
||||
**Example:**
|
||||
compile and run all tests under folders threadsafe_function and typed_threadsafe_function and also the objectwrap.cc file
|
||||
npm run unit --filter='*function objectwrap'
|
||||
|
||||
### **Debug**
|
||||
|
||||
To run the **node-addon-api** tests with `--debug` option:
|
||||
|
||||
```
|
||||
npm run-script dev
|
||||
```
|
||||
|
||||
If you want a faster build, you might use the following option:
|
||||
|
||||
```
|
||||
npm run-script dev:incremental
|
||||
```
|
||||
|
||||
Take a look and get inspired by our **[test suite](https://github.com/nodejs/node-addon-api/tree/HEAD/test)**
|
||||
|
||||
### **Benchmarks**
|
||||
|
||||
You can run the available benchmarks using the following command:
|
||||
|
||||
```
|
||||
npm run-script benchmark
|
||||
```
|
||||
|
||||
See [benchmark/README.md](benchmark/README.md) for more details about running and adding benchmarks.
|
||||
|
||||
<a name="resources"></a>
|
||||
|
||||
### **More resource and info about native Addons**
|
||||
- **[C++ Addons](https://nodejs.org/dist/latest/docs/api/addons.html)**
|
||||
- **[Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)**
|
||||
- **[Node-API - Next Generation Node API for Native Modules](https://youtu.be/-Oniup60Afs)**
|
||||
- **[How We Migrated Realm JavaScript From NAN to Node-API](https://developer.mongodb.com/article/realm-javascript-nan-to-n-api)**
|
||||
|
||||
As node-addon-api's core mission is to expose the plain C Node-API as C++
|
||||
wrappers, tools that facilitate n-api/node-addon-api providing more
|
||||
convenient patterns for developing a Node.js add-on with n-api/node-addon-api
|
||||
can be published to NPM as standalone packages. It is also recommended to tag
|
||||
such packages with `node-addon-api` to provide more visibility to the community.
|
||||
|
||||
Quick links to NPM searches: [keywords:node-addon-api](https://www.npmjs.com/search?q=keywords%3Anode-addon-api).
|
||||
|
||||
<a name="other-bindings"></a>
|
||||
|
||||
### **Other bindings**
|
||||
|
||||
- **[napi-rs](https://napi.rs)** - (`Rust`)
|
||||
|
||||
<a name="badges"></a>
|
||||
|
||||
### **Badges**
|
||||
|
||||
The use of badges is recommended to indicate the minimum version of Node-API
|
||||
required for the module. This helps to determine which Node.js major versions are
|
||||
supported. Addon maintainers can consult the [Node-API support matrix][] to determine
|
||||
which Node.js versions provide a given Node-API version. The following badges are
|
||||
available:
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## **Contributing**
|
||||
|
||||
We love contributions from the community to **node-addon-api**!
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details on our philosophy around extending this module.
|
||||
|
||||
<a name="contributors"></a>
|
||||
|
||||
## Team members
|
||||
|
||||
### Active
|
||||
| Name | GitHub Link |
|
||||
| ------------------- | ----------------------------------------------------- |
|
||||
| Anna Henningsen | [addaleax](https://github.com/addaleax) |
|
||||
| Chengzhong Wu | [legendecas](https://github.com/legendecas) |
|
||||
| Jack Xia | [JckXia](https://github.com/JckXia) |
|
||||
| Kevin Eady | [KevinEady](https://github.com/KevinEady) |
|
||||
| Michael Dawson | [mhdawson](https://github.com/mhdawson) |
|
||||
| Nicola Del Gobbo | [NickNaso](https://github.com/NickNaso) |
|
||||
| Vladimir Morozov | [vmoroz](https://github.com/vmoroz) |
|
||||
|
||||
### Emeritus
|
||||
| Name | GitHub Link |
|
||||
| ------------------- | ----------------------------------------------------- |
|
||||
| Arunesh Chandra | [aruneshchandra](https://github.com/aruneshchandra) |
|
||||
| Benjamin Byholm | [kkoopa](https://github.com/kkoopa) |
|
||||
| Gabriel Schulhof | [gabrielschulhof](https://github.com/gabrielschulhof) |
|
||||
| Hitesh Kanwathirtha | [digitalinfinity](https://github.com/digitalinfinity) |
|
||||
| Jason Ginchereau | [jasongin](https://github.com/jasongin) |
|
||||
| Jim Schlight | [jschlight](https://github.com/jschlight) |
|
||||
| Sampson Gao | [sampsongao](https://github.com/sampsongao) |
|
||||
| Taylor Woll | [boingoing](https://github.com/boingoing) |
|
||||
|
||||
<a name="license"></a>
|
||||
|
||||
Licensed under [MIT](./LICENSE.md)
|
||||
|
||||
[ABI stability guide]: https://nodejs.org/en/docs/guides/abi-stability/
|
||||
[Node-API support matrix]: https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api_version_matrix
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
import { hasUriEncodedChars } from "./utils.js";
|
||||
function encode(obj, pfx) {
|
||||
let k, i, tmp, str = "";
|
||||
for (k in obj) {
|
||||
if ((tmp = obj[k]) !== void 0) {
|
||||
if (Array.isArray(tmp)) {
|
||||
for (i = 0; i < tmp.length; i++) {
|
||||
str && (str += "&");
|
||||
str += encodeURIComponent(k) + "=" + encodeURIComponent(tmp[i]);
|
||||
}
|
||||
} else {
|
||||
str && (str += "&");
|
||||
str += encodeURIComponent(k) + "=" + encodeURIComponent(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (pfx || "") + str;
|
||||
}
|
||||
function toValue(mix) {
|
||||
if (!mix) return "";
|
||||
const str = hasUriEncodedChars(mix) ? decodeURIComponent(mix) : decodeURIComponent(encodeURIComponent(mix));
|
||||
if (str === "false") return false;
|
||||
if (str === "true") return true;
|
||||
return +str * 0 === 0 && +str + "" === str ? +str : str;
|
||||
}
|
||||
function decode(str, pfx) {
|
||||
let tmp, k;
|
||||
const out = {}, arr = (pfx ? str.substr(pfx.length) : str).split("&");
|
||||
while (tmp = arr.shift()) {
|
||||
const equalIndex = tmp.indexOf("=");
|
||||
if (equalIndex !== -1) {
|
||||
k = tmp.slice(0, equalIndex);
|
||||
k = decodeURIComponent(k);
|
||||
const value = tmp.slice(equalIndex + 1);
|
||||
if (out[k] !== void 0) {
|
||||
out[k] = [].concat(out[k], toValue(value));
|
||||
} else {
|
||||
out[k] = toValue(value);
|
||||
}
|
||||
} else {
|
||||
k = tmp;
|
||||
k = decodeURIComponent(k);
|
||||
out[k] = "";
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
export {
|
||||
decode,
|
||||
encode
|
||||
};
|
||||
//# sourceMappingURL=qss.js.map
|
||||
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2018, Viacheslav Lotsmanov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N O P Q H R S T"},C:{"1":"GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r qC rC","194":"0 9 s t u v w x y z AB BB CB DB EB FB"},D:{"1":"0 9 U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T"},E:{"1":"KC gC hC iC jC 3C","2":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C"},F:{"1":"0 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 lD mD IC JC KC nD","2":"J dD eD fD gD hD TC iD jD kD"},Q:{"2":"oD"},R:{"1":"pD"},S:{"2":"qD rD"}},B:5,C:"CSS content-visibility",D:true};
|
||||
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getFunctionName;
|
||||
var _index = require("../validators/generated/index.js");
|
||||
function getNameFromLiteralId(id) {
|
||||
if ((0, _index.isNullLiteral)(id)) {
|
||||
return "null";
|
||||
}
|
||||
if ((0, _index.isRegExpLiteral)(id)) {
|
||||
return `/${id.pattern}/${id.flags}`;
|
||||
}
|
||||
if ((0, _index.isTemplateLiteral)(id)) {
|
||||
return id.quasis.map(quasi => quasi.value.raw).join("");
|
||||
}
|
||||
if (id.value !== undefined) {
|
||||
return String(id.value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function getObjectMemberKey(node) {
|
||||
if (!node.computed || (0, _index.isLiteral)(node.key)) {
|
||||
return node.key;
|
||||
}
|
||||
}
|
||||
function getFunctionName(node, parent) {
|
||||
if ("id" in node && node.id) {
|
||||
return {
|
||||
name: node.id.name,
|
||||
originalNode: node.id
|
||||
};
|
||||
}
|
||||
let prefix = "";
|
||||
let id;
|
||||
if ((0, _index.isObjectProperty)(parent, {
|
||||
value: node
|
||||
})) {
|
||||
id = getObjectMemberKey(parent);
|
||||
} else if ((0, _index.isObjectMethod)(node) || (0, _index.isClassMethod)(node)) {
|
||||
id = getObjectMemberKey(node);
|
||||
if (node.kind === "get") prefix = "get ";else if (node.kind === "set") prefix = "set ";
|
||||
} else if ((0, _index.isVariableDeclarator)(parent, {
|
||||
init: node
|
||||
})) {
|
||||
id = parent.id;
|
||||
} else if ((0, _index.isAssignmentExpression)(parent, {
|
||||
operator: "=",
|
||||
right: node
|
||||
})) {
|
||||
id = parent.left;
|
||||
}
|
||||
if (!id) return null;
|
||||
const name = (0, _index.isLiteral)(id) ? getNameFromLiteralId(id) : (0, _index.isIdentifier)(id) ? id.name : (0, _index.isPrivateName)(id) ? id.id.name : null;
|
||||
if (name == null) return null;
|
||||
return {
|
||||
name: prefix + name,
|
||||
originalNode: id
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=getFunctionName.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_objectWithoutPropertiesLoose","source","excluded","target","key","Object","prototype","hasOwnProperty","call","indexOf"],"sources":["../../src/helpers/objectWithoutPropertiesLoose.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _objectWithoutPropertiesLoose<\n T extends object,\n K extends PropertyKey[],\n>(\n source: T | null | undefined,\n excluded: K,\n): Pick<T, Exclude<keyof T, K[number]>>;\nexport default function _objectWithoutPropertiesLoose<\n T extends object,\n K extends Array<keyof T>,\n>(source: T | null | undefined, excluded: K): Omit<T, K[number]>;\nexport default function _objectWithoutPropertiesLoose<T extends object>(\n source: T | null | undefined,\n excluded: PropertyKey[],\n): Partial<T> {\n if (source == null) return {};\n\n var target: Partial<T> = {};\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n if (excluded.indexOf(key) !== -1) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n"],"mappings":";;;;;;AAae,SAASA,6BAA6BA,CACnDC,MAA4B,EAC5BC,QAAuB,EACX;EACZ,IAAID,MAAM,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;EAE7B,IAAIE,MAAkB,GAAG,CAAC,CAAC;EAE3B,KAAK,IAAIC,GAAG,IAAIH,MAAM,EAAE;IACtB,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,MAAM,EAAEG,GAAG,CAAC,EAAE;MACrD,IAAIF,QAAQ,CAACO,OAAO,CAACL,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;MAClCD,MAAM,CAACC,GAAG,CAAC,GAAGH,MAAM,CAACG,GAAG,CAAC;IAC3B;EACF;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N O P"},C:{"1":"0 9 NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB qC rC"},D:{"1":"0 9 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC","196":"wB NC xB yB","324":"zB"},E:{"1":"ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E F A B C sC SC tC uC vC wC TC FC","516":"L M G GC xC yC zC UC VC HC 0C IC WC XC YC"},F:{"1":"0 pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"2":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"rD","2":"qD"}},B:5,C:"Server Timing",D:true};
|
||||
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = string => {
|
||||
if (typeof string !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
// Escape characters with special meaning either inside or outside character sets.
|
||||
// Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
||||
return string
|
||||
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
|
||||
.replace(/-/g, '\\x2d');
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports.browserVersions = require('../../data/browserVersions')
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -n $TRAVIS_TAG && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then
|
||||
echo "About to publish $TRAVIS_TAG to ajv-dist..."
|
||||
|
||||
git config user.email "$GIT_USER_EMAIL"
|
||||
git config user.name "$GIT_USER_NAME"
|
||||
|
||||
git clone https://${GITHUB_TOKEN}@github.com/ajv-validator/ajv-dist.git ../ajv-dist
|
||||
|
||||
rm -rf ../ajv-dist/dist
|
||||
mkdir ../ajv-dist/dist
|
||||
cp ./dist/ajv.* ../ajv-dist/dist
|
||||
cat bower.json | sed 's/"name": "ajv"/"name": "ajv-dist"/' > ../ajv-dist/bower.json
|
||||
cd ../ajv-dist
|
||||
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
echo "Changes detected. Updating master branch..."
|
||||
git add -A
|
||||
git commit -m "updated by travis build #$TRAVIS_BUILD_NUMBER"
|
||||
git push --quiet origin master > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
echo "Publishing tag..."
|
||||
|
||||
git tag $TRAVIS_TAG
|
||||
git push --tags > /dev/null 2>&1
|
||||
|
||||
echo "Done"
|
||||
fi
|
||||
@@ -0,0 +1,15 @@
|
||||
# Installation
|
||||
> `npm install --save @types/json-schema`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for json-schema (https://github.com/kriszyp/json-schema).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 07 Nov 2023 03:09:37 GMT
|
||||
* Dependencies: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Boris Cherny](https://github.com/bcherny), [Lucian Buzzo](https://github.com/lucianbuzzo), [Roland Groza](https://github.com/rolandjitsu), and [Jason Kwok](https://github.com/JasonHK).
|
||||
@@ -0,0 +1,9 @@
|
||||
import http from "./http";
|
||||
const handler = {
|
||||
scheme: "https",
|
||||
domainHost: http.domainHost,
|
||||
parse: http.parse,
|
||||
serialize: http.serialize
|
||||
};
|
||||
export default handler;
|
||||
//# sourceMappingURL=https.js.map
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var code = require('./code');
|
||||
|
||||
function isStrictModeReservedWordES6(id) {
|
||||
switch (id) {
|
||||
case 'implements':
|
||||
case 'interface':
|
||||
case 'package':
|
||||
case 'private':
|
||||
case 'protected':
|
||||
case 'public':
|
||||
case 'static':
|
||||
case 'let':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isKeywordES5(id, strict) {
|
||||
// yield should not be treated as keyword under non-strict mode.
|
||||
if (!strict && id === 'yield') {
|
||||
return false;
|
||||
}
|
||||
return isKeywordES6(id, strict);
|
||||
}
|
||||
|
||||
function isKeywordES6(id, strict) {
|
||||
if (strict && isStrictModeReservedWordES6(id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (id.length) {
|
||||
case 2:
|
||||
return (id === 'if') || (id === 'in') || (id === 'do');
|
||||
case 3:
|
||||
return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try');
|
||||
case 4:
|
||||
return (id === 'this') || (id === 'else') || (id === 'case') ||
|
||||
(id === 'void') || (id === 'with') || (id === 'enum');
|
||||
case 5:
|
||||
return (id === 'while') || (id === 'break') || (id === 'catch') ||
|
||||
(id === 'throw') || (id === 'const') || (id === 'yield') ||
|
||||
(id === 'class') || (id === 'super');
|
||||
case 6:
|
||||
return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
|
||||
(id === 'switch') || (id === 'export') || (id === 'import');
|
||||
case 7:
|
||||
return (id === 'default') || (id === 'finally') || (id === 'extends');
|
||||
case 8:
|
||||
return (id === 'function') || (id === 'continue') || (id === 'debugger');
|
||||
case 10:
|
||||
return (id === 'instanceof');
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isReservedWordES5(id, strict) {
|
||||
return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
|
||||
}
|
||||
|
||||
function isReservedWordES6(id, strict) {
|
||||
return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
|
||||
}
|
||||
|
||||
function isRestrictedWord(id) {
|
||||
return id === 'eval' || id === 'arguments';
|
||||
}
|
||||
|
||||
function isIdentifierNameES5(id) {
|
||||
var i, iz, ch;
|
||||
|
||||
if (id.length === 0) { return false; }
|
||||
|
||||
ch = id.charCodeAt(0);
|
||||
if (!code.isIdentifierStartES5(ch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 1, iz = id.length; i < iz; ++i) {
|
||||
ch = id.charCodeAt(i);
|
||||
if (!code.isIdentifierPartES5(ch)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function decodeUtf16(lead, trail) {
|
||||
return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
|
||||
}
|
||||
|
||||
function isIdentifierNameES6(id) {
|
||||
var i, iz, ch, lowCh, check;
|
||||
|
||||
if (id.length === 0) { return false; }
|
||||
|
||||
check = code.isIdentifierStartES6;
|
||||
for (i = 0, iz = id.length; i < iz; ++i) {
|
||||
ch = id.charCodeAt(i);
|
||||
if (0xD800 <= ch && ch <= 0xDBFF) {
|
||||
++i;
|
||||
if (i >= iz) { return false; }
|
||||
lowCh = id.charCodeAt(i);
|
||||
if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
|
||||
return false;
|
||||
}
|
||||
ch = decodeUtf16(ch, lowCh);
|
||||
}
|
||||
if (!check(ch)) {
|
||||
return false;
|
||||
}
|
||||
check = code.isIdentifierPartES6;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function isIdentifierES5(id, strict) {
|
||||
return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
|
||||
}
|
||||
|
||||
function isIdentifierES6(id, strict) {
|
||||
return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isKeywordES5: isKeywordES5,
|
||||
isKeywordES6: isKeywordES6,
|
||||
isReservedWordES5: isReservedWordES5,
|
||||
isReservedWordES6: isReservedWordES6,
|
||||
isRestrictedWord: isRestrictedWord,
|
||||
isIdentifierNameES5: isIdentifierNameES5,
|
||||
isIdentifierNameES6: isIdentifierNameES6,
|
||||
isIdentifierES5: isIdentifierES5,
|
||||
isIdentifierES6: isIdentifierES6
|
||||
};
|
||||
}());
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
var division{{=$lvl}};
|
||||
if ({{?$isData}}
|
||||
{{=$schemaValue}} !== undefined && (
|
||||
typeof {{=$schemaValue}} != 'number' ||
|
||||
{{?}}
|
||||
(division{{=$lvl}} = {{=$data}} / {{=$schemaValue}},
|
||||
{{? it.opts.multipleOfPrecision }}
|
||||
Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}}
|
||||
{{??}}
|
||||
division{{=$lvl}} !== parseInt(division{{=$lvl}})
|
||||
{{?}}
|
||||
)
|
||||
{{?$isData}} ) {{?}} ) {
|
||||
{{# def.error:'multipleOf' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A mC","132":"B"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 9 fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 nC LC J PB K D E F A B C L M G N O P QB qC rC","66":"6 7 8 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB"},D:{"1":"0 9 UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"J PB K D E F A B C L M G N","33":"4 5 6 7 8 RB SB TB","66":"1 2 3 O P QB"},E:{"1":"E F A B C L M G wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D sC SC tC uC vC"},F:{"1":"0 1 2 3 4 5 6 7 8 G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"F B C 4C 5C 6C 7C FC kC 8C GC"},G:{"2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD","260":"MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"1":"I cD","2":"LC J XD YD ZD aD lC bD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"B","2":"A"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 hD TC iD jD kD lD mD IC JC KC nD","2":"J dD eD fD gD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:2,C:"Media Source Extensions",D:true};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"K D E F mC"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"J PB K D E"},E:{"1":"K D E F A B C L M G tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB sC SC"},F:{"1":"0 1 2 3 4 5 6 7 8 B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 6C 7C FC kC 8C GC","2":"F 4C 5C"},G:{"4":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"4":"WD"},I:{"4":"LC J I XD YD ZD aD lC bD cD"},J:{"1":"A","4":"D"},K:{"4":"A B C H FC kC GC"},L:{"4":"I"},M:{"4":"EC"},N:{"4":"A B"},O:{"4":"HC"},P:{"4":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"4":"pD"},S:{"2":"qD rD"}},B:1,C:"Spellcheck attribute",D:true};
|
||||
Reference in New Issue
Block a user