update
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 Jordan Harband
|
||||
|
||||
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,54 @@
|
||||
# dunder-proto <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
If available, the `Object.prototype.__proto__` accessor and mutator, call-bound.
|
||||
|
||||
## Getting started
|
||||
|
||||
```sh
|
||||
npm install --save dunder-proto
|
||||
```
|
||||
|
||||
## Usage/Examples
|
||||
|
||||
```js
|
||||
const assert = require('assert');
|
||||
const getDunder = require('dunder-proto/get');
|
||||
const setDunder = require('dunder-proto/set');
|
||||
|
||||
const obj = {};
|
||||
|
||||
assert.equal('toString' in obj, true);
|
||||
assert.equal(getDunder(obj), Object.prototype);
|
||||
|
||||
setDunder(obj, null);
|
||||
|
||||
assert.equal('toString' in obj, false);
|
||||
assert.equal(getDunder(obj), null);
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
Clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/dunder-proto
|
||||
[npm-version-svg]: https://versionbadg.es/es-shims/dunder-proto.svg
|
||||
[deps-svg]: https://david-dm.org/es-shims/dunder-proto.svg
|
||||
[deps-url]: https://david-dm.org/es-shims/dunder-proto
|
||||
[dev-deps-svg]: https://david-dm.org/es-shims/dunder-proto/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/es-shims/dunder-proto#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/dunder-proto.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/dunder-proto.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/dunder-proto.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=dunder-proto
|
||||
[codecov-image]: https://codecov.io/gh/es-shims/dunder-proto/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/es-shims/dunder-proto/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/dunder-proto
|
||||
[actions-url]: https://github.com/es-shims/dunder-proto/actions
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Jordan Harband
|
||||
|
||||
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,42 @@
|
||||
'use strict';
|
||||
|
||||
var isGlob = require('is-glob');
|
||||
var pathPosixDirname = require('path').posix.dirname;
|
||||
var isWin32 = require('os').platform() === 'win32';
|
||||
|
||||
var slash = '/';
|
||||
var backslash = /\\/g;
|
||||
var enclosure = /[\{\[].*[\}\]]$/;
|
||||
var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
|
||||
var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @param {Object} opts
|
||||
* @param {boolean} [opts.flipBackslashes=true]
|
||||
* @returns {string}
|
||||
*/
|
||||
module.exports = function globParent(str, opts) {
|
||||
var options = Object.assign({ flipBackslashes: true }, opts);
|
||||
|
||||
// flip windows path separators
|
||||
if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
|
||||
str = str.replace(backslash, slash);
|
||||
}
|
||||
|
||||
// special case for strings ending in enclosure containing path separator
|
||||
if (enclosure.test(str)) {
|
||||
str += slash;
|
||||
}
|
||||
|
||||
// preserves full path in case of trailing path separator
|
||||
str += 'a';
|
||||
|
||||
// remove path parts that are globby
|
||||
do {
|
||||
str = pathPosixDirname(str);
|
||||
} while (isGlob(str) || globby.test(str));
|
||||
|
||||
// remove escape chars and return result
|
||||
return str.replace(escaped, '$1');
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
allow:
|
||||
- dependency-type: production
|
||||
@@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
* REQUIREMENT: This definition is dependent on the @types/node definition.
|
||||
* Install with `npm install @types/node --save-dev`
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'iconv-lite' {
|
||||
// Basic API
|
||||
export function decode(buffer: Buffer, encoding: string, options?: Options): string;
|
||||
|
||||
export function encode(content: string, encoding: string, options?: Options): Buffer;
|
||||
|
||||
export function encodingExists(encoding: string): boolean;
|
||||
|
||||
// Stream API
|
||||
export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
// Low-level stream APIs
|
||||
export function getEncoder(encoding: string, options?: Options): EncoderStream;
|
||||
|
||||
export function getDecoder(encoding: string, options?: Options): DecoderStream;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
stripBOM?: boolean;
|
||||
addBOM?: boolean;
|
||||
defaultEncoding?: string;
|
||||
}
|
||||
|
||||
export interface EncoderStream {
|
||||
write(str: string): Buffer;
|
||||
end(): Buffer | undefined;
|
||||
}
|
||||
|
||||
export interface DecoderStream {
|
||||
write(buf: Buffer): string;
|
||||
end(): string | undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user