Phase 1 PWA: prayer times, qibla, quran, hijri, tasbih, 99 names

This commit is contained in:
Hermes Bot
2026-08-06 11:55:47 +08:00
parent 4def05d0ef
commit 0d37e7ec1e
10869 changed files with 959465 additions and 18 deletions
+12
View File
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/es-abstract-get
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+9
View File
@@ -0,0 +1,9 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}
+15
View File
@@ -0,0 +1,15 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v1.0.0 - 2026-06-15
### Commits
- Initial implementation, readme, tests, types, etc [`3e77971`](https://github.com/ljharb/es-abstract-get/commit/3e77971f2503a0db5232da5943e251353025dabb)
- Initial commit [`a267b43`](https://github.com/ljharb/es-abstract-get/commit/a267b430bba77c1e5f7efea3f5af73f33ec19d9d)
- npm init [`2751874`](https://github.com/ljharb/es-abstract-get/commit/2751874f7a511bcd5fa35864aa1cf180131ff175)
- Only apps should have lockfiles [`bade6ef`](https://github.com/ljharb/es-abstract-get/commit/bade6ef08f687091545bd6c41517424d989853a5)
+11
View File
@@ -0,0 +1,11 @@
import { PropertyKey } from './isPropertyKey';
declare function Get<
T extends object,
K extends keyof T & PropertyKey,
>(
O: T,
P: K,
): T[keyof T] | undefined;
export = Get;
+26
View File
@@ -0,0 +1,26 @@
'use strict';
var $TypeError = require('es-errors/type');
var inspect = require('object-inspect');
var isObject = require('es-object-atoms/isObject');
var isPropertyKey = require('./isPropertyKey');
// https://262.ecma-international.org/6.0/#sec-get-o-p
/** @type {import('./Get')} */
module.exports = function Get(O, P) {
// 7.3.1.1
var isObj = isObject(O);
if (!isObj) {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
// 7.3.1.2
if (!isPropertyKey(P)) {
throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P));
}
// 7.3.1.3
return O[P];
};
+13
View File
@@ -0,0 +1,13 @@
import { PropertyKey } from './isPropertyKey';
type GoodMethodKey<O, K extends PropertyKey> =
K extends keyof O
? (O[K] extends Function | null | undefined ? K : never)
: K;
declare function GetMethod<O extends {}, K extends PropertyKey>(
V: O,
P: K & GoodMethodKey<O, K>,
): Function | undefined;
export = GetMethod;
+36
View File
@@ -0,0 +1,36 @@
'use strict';
var $TypeError = require('es-errors/type');
var isCallable = require('is-callable');
var inspect = require('object-inspect');
var GetV = require('./GetV');
var isPropertyKey = require('./isPropertyKey');
// https://262.ecma-international.org/6.0/#sec-getmethod
/** @type {import('./GetMethod')} */
module.exports = function GetMethod(O, P) {
// 7.3.9.1
if (!isPropertyKey(P)) {
throw new $TypeError('Assertion failed: P is not a Property Key');
}
// 7.3.9.2
var func = GetV(O, P);
// 7.3.9.4
if (func == null) {
return void 0;
}
// 7.3.9.5
if (!isCallable(func)) {
throw new $TypeError(inspect(P) + ' is not a function: ' + inspect(func));
}
// 7.3.9.6
return func;
};
+11
View File
@@ -0,0 +1,11 @@
declare function GetV<T extends {}, K extends keyof T>(
V: T,
P: K,
): T[K];
declare function GetV<T extends {}, K extends keyof T>(
V: T,
P: PropertyKey,
): unknown;
export = GetV;
+23
View File
@@ -0,0 +1,23 @@
'use strict';
var $TypeError = require('es-errors/type');
var inspect = require('object-inspect');
var isPropertyKey = require('./isPropertyKey');
// https://262.ecma-international.org/6.0/#sec-getv
/** @type {import('./GetV')} */
module.exports = function GetV(V, P) {
// 7.3.2.1
if (!isPropertyKey(P)) {
throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P));
}
// 7.3.2.2-3
// var O = ToObject(V);
// 7.3.2.4
return /** @type {Record<typeof P, unknown>} */ (V)[P]; // O.[[Get]](P, V)
};
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 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.
+67
View File
@@ -0,0 +1,67 @@
# es-abstract-get <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]
The ECMAScript “getting properties” abstract operations — [`Get`][Get], [`GetV`][GetV], and [`GetMethod`][GetMethod] — plus the [`isPropertyKey`][isPropertyKey] helper they share, with TypeScript types.
## Motivation
These operations are also available in [`es-abstract`][es-abstract],
but `es-abstract` ships every abstract operation for every spec edition,
so depending on it to use one or two of them pulls in a very large dependency graph.
These three operations (and `isPropertyKey`) historically never differ between spec editions,
so theyre split out here:
a package that only needs `Get`, `GetV`, `GetMethod`, or `isPropertyKey` can depend on this instead and get a far smaller install.
Each operation is its own entry point - there is intentionally no main (`.`) export - so you only pay for what you import.
## Example
```js
var Get = require('es-abstract-get/Get');
var GetV = require('es-abstract-get/GetV');
var GetMethod = require('es-abstract-get/GetMethod');
var isPropertyKey = require('es-abstract-get/isPropertyKey');
var assert = require('assert');
// Get(O, P): O must be an Object
assert.equal(Get({ a: 1 }, 'a'), 1);
// GetV(V, P): V may be a primitive (it is coerced to an object for the lookup,
// but the original value is the receiver)
assert.equal(GetV('abc', 'length'), 3);
// GetMethod(O, P): returns undefined for null/undefined, throws if not callable
assert.equal(GetMethod({}, 'toString'), Object.prototype.toString);
assert.equal(GetMethod({ a: null }, 'a'), undefined);
// isPropertyKey(argument): true for strings and symbols
assert.equal(isPropertyKey('a'), true);
assert.equal(isPropertyKey(Symbol.iterator), true);
assert.equal(isPropertyKey(1), false);
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/es-abstract-get
[npm-version-svg]: https://versionbadg.es/ljharb/es-abstract-get.svg
[npm-badge-png]: https://nodei.co/npm/es-abstract-get.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/es-abstract-get.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/es-abstract-get.svg
[downloads-url]: https://npm-stat.com/charts.html?package=es-abstract-get
[codecov-image]: https://codecov.io/gh/ljharb/es-abstract-get/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/es-abstract-get/
[actions-image]: https://img.shields.io/github/check-runs/ljharb/es-abstract-get/main
[actions-url]: https://github.com/ljharb/es-abstract-get/actions
[es-abstract]: https://npmjs.org/package/es-abstract
[Get]: https://tc39.es/ecma262/#sec-get-o-p
[GetV]: https://tc39.es/ecma262/#sec-getv
[GetMethod]: https://tc39.es/ecma262/#sec-getmethod
[isPropertyKey]: https://tc39.es/ecma262/#sec-ispropertykey
+42
View File
@@ -0,0 +1,42 @@
import ljharb from '@ljharb/eslint-config/flat';
import ljharbTests from '@ljharb/eslint-config/flat/tests';
export default [
{
ignores: [
'coverage',
'.nyc_output',
],
},
...ljharb,
{
rules: {
eqeqeq: ['error', 'allow-null'],
'func-style': ['error', 'declaration'],
'id-length': [
'error', {
max: 24,
min: 1,
properties: 'never',
},
],
'multiline-comment-style': 'off',
'new-cap': [
'error', {
capIsNewExceptions: [
'Get',
'GetMethod',
'GetV',
'ToObject',
],
},
],
'no-extra-parens': 'off',
'no-magic-numbers': 'off',
},
},
...ljharbTests.map((c) => ({
...c,
files: ['test/**'],
})),
];
+9
View File
@@ -0,0 +1,9 @@
declare function isPropertyKey(
argument: unknown,
): argument is isPropertyKey.PropertyKey;
declare namespace isPropertyKey {
export type PropertyKey = string | symbol;
}
export = isPropertyKey;
+6
View File
@@ -0,0 +1,6 @@
'use strict';
/** @type {import('./isPropertyKey')} */
module.exports = function isPropertyKey(argument) {
return typeof argument === 'string' || typeof argument === 'symbol';
};
+95
View File
@@ -0,0 +1,95 @@
{
"name": "es-abstract-get",
"version": "1.0.0",
"description": "ECMAScript Abstract Operations for \"getting properties\" (Get, GetV, GetMethod)",
"main": false,
"exports": {
"./Get": "./Get.js",
"./GetV": "./GetV.js",
"./GetMethod": "./GetMethod.js",
"./isPropertyKey": "./isPropertyKey.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "npx npm@\">=10.2\" audit --production",
"tests-only": "nyc tape 'test/**/*.js'",
"lint": "eslint .",
"postlint": "tsc && attw -P",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/es-abstract-get.git"
},
"keywords": [
"ECMAScript",
"ES",
"AO",
"abstract operation",
"GetMethod",
"GetV",
"Get",
"isPropertyKey",
"property",
"properties"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.2",
"is-callable": "^1.2.7",
"object-inspect": "^1.13.4"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.18.3",
"@ljharb/eslint-config": "^22.2.3",
"@ljharb/tsconfig": "^0.3.2",
"@types/for-each": "^0.3.3",
"@types/is-callable": "^1.1.2",
"@types/object-inspect": "^1.13.0",
"@types/tape": "^5.8.1",
"auto-changelog": "^2.6.0",
"es-define-property": "^1.0.1",
"es-value-fixtures": "^1.7.1",
"eslint": "^10.5.0",
"for-each": "^0.3.5",
"jiti": "^0.0.0",
"mock-property": "^1.1.0",
"npmignore": "^0.3.5",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.10.1",
"typescript": "next"
},
"engines": {
"node": ">= 0.4"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"bugs": {
"url": "https://github.com/ljharb/es-abstract-get/issues"
},
"homepage": "https://github.com/ljharb/es-abstract-get#readme"
}
+43
View File
@@ -0,0 +1,43 @@
'use strict';
var test = require('tape');
var v = require('es-value-fixtures');
var Get = require('../Get');
test('Get', function (t) {
t['throws'](
// @ts-expect-error
function () { return Get('a', 'a'); },
TypeError,
'Throws a TypeError if `O` is not an Object'
);
t['throws'](
// @ts-expect-error
function () { return Get({ 7: 7 }, 7); },
TypeError,
'Throws a TypeError if `P` is not a property key'
);
var sentinel = {};
t.test('Symbols', { skip: !v.hasSymbols }, function (st) {
var sym = Symbol('sym');
var obj = /** @type {Record<symbol, unknown>} */ ({});
obj[sym] = sentinel;
st.equal(Get(obj, sym), sentinel, 'returns property `P` if it exists on object `O`');
st.end();
});
t.equal(Get({ a: sentinel }, 'a'), sentinel, 'returns property `P` if it exists on object `O`');
t.equal(
// @ts-expect-error
Get({}, 'a'),
undefined,
'returns undefined if property `P` does not exist on object `O`'
);
t.end();
});
+42
View File
@@ -0,0 +1,42 @@
'use strict';
var test = require('tape');
var forEach = require('for-each');
var v = require('es-value-fixtures');
var debug = require('object-inspect');
var GetMethod = require('../GetMethod');
test('GetMethod', function (t) {
forEach(v.nonPropertyKeys, function (nonPropertyKey) {
t['throws'](
// @ts-expect-error
function () { return GetMethod({}, nonPropertyKey); },
TypeError,
debug(nonPropertyKey) + ' is not a Property Key'
);
});
t['throws'](
// @ts-expect-error
function () { return GetMethod({ 7: 7 }, 7); },
TypeError,
'Throws a TypeError if `P` is not a property key'
);
t.equal(GetMethod({}, 'a'), undefined, 'returns undefined if property is undefined');
t.equal(GetMethod({ a: null }, 'a'), undefined, 'returns undefined if property is null');
t.equal(GetMethod({ a: undefined }, 'a'), undefined, 'returns undefined if property is undefined');
var obj = { a: function () {} };
t['throws'](
// @ts-expect-error
function () { GetMethod({ a: 'b' }, 'a'); },
TypeError,
'throws a TypeError if property exists and is not callable'
);
t.equal(GetMethod(obj, 'a'), obj.a, 'returns property if it is callable');
t.end();
});
+43
View File
@@ -0,0 +1,43 @@
'use strict';
var test = require('tape');
var $defineProperty = require('es-define-property');
var mockProperty = require('mock-property');
var GetV = require('../GetV');
test('GetV', function (t) {
t['throws'](
function () { return GetV({ 7: 7 }, 7); },
TypeError,
'Throws a TypeError if `P` is not a property key'
);
var obj = { a: function () {} };
t.equal(GetV(obj, 'a'), obj.a, 'returns property if it exists');
t.equal(GetV(obj, 'b'), undefined, 'returns undefined if property does not exist');
t.test(
'getter observability of the receiver',
{ skip: !$defineProperty || !Object.isExtensible(Number.prototype) },
function (st) {
/** @type {unknown[]} */
var receivers = [];
st.teardown(mockProperty(/** @type {Record<PropertyKey, unknown>} */ (/** @type {unknown} */ (Number.prototype)), 'foo', {
get: /** @this {number | Number} */ function () {
receivers.push(this);
}
}));
GetV(42, 'foo');
GetV(Object(42), 'foo');
st.deepEqual(receivers, [42, Object(42)]);
st.end();
}
);
t.end();
});
+26
View File
@@ -0,0 +1,26 @@
'use strict';
var test = require('tape');
var forEach = require('for-each');
var v = require('es-value-fixtures');
var debug = require('object-inspect');
var isPropertyKey = require('../isPropertyKey');
/** @import { PropertyKey } from '../isPropertyKey' */
test('isPropertyKey', function (t) {
forEach(v.nonPropertyKeys, function (nonPropertyKey) {
t.equal(isPropertyKey(nonPropertyKey), false, debug(nonPropertyKey) + ' is not a Property Key');
});
var propertyKeys = /** @type {PropertyKey[]} */ ([]).concat(
v.strings,
v.hasSymbols ? v.symbols : []
);
forEach(propertyKeys, function (propertyKey) {
t.equal(isPropertyKey(propertyKey), true, debug(propertyKey) + ' is a Property Key');
});
t.end();
});
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "@ljharb/tsconfig",
"exclude": [
"coverage",
],
}